diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-03-31 09:36:10 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-04-04 10:58:55 -0700 |
| commit | af9a144207eb1b4fdfd735b29f90c41f80aa9a2e (patch) | |
| tree | f648cd59627a33cb5f6718e0686c36b545353e45 /python/ovs/daemon.py | |
| parent | 279c9e030818e039bb1c26be76e2cc1e8f6b13a6 (diff) | |
| download | openvswitch-af9a144207eb1b4fdfd735b29f90c41f80aa9a2e.tar.gz | |
daemon: Tolerate EINTR in fork_and_wait_for_startup().
It seems possible that a signal coming in at the wrong time could confuse
this code. It's always best to loop on EINTR.
Diffstat (limited to 'python/ovs/daemon.py')
| -rw-r--r-- | python/ovs/daemon.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py index 4e54e697f..4df237159 100644 --- a/python/ovs/daemon.py +++ b/python/ovs/daemon.py @@ -213,10 +213,15 @@ def _fork_and_wait_for_startup(): # Running in parent process. os.close(wfd) ovs.fatal_signal.fork() - try: - s = os.read(rfd, 1) - except OSError, e: - s = "" + while True: + try: + s = os.read(rfd, 1) + error = 0 + except OSError, e: + s = "" + error = e.errno + if error != errno.EINTR: + break if len(s) != 1: retval, status = _waitpid(pid, 0) if (retval == pid and |
