mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
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.
This commit is contained in:
@@ -244,11 +244,12 @@ fork_and_wait_for_startup(int *fdp)
|
||||
pid = fork();
|
||||
if (pid > 0) {
|
||||
/* Running in parent process. */
|
||||
size_t bytes_read;
|
||||
char c;
|
||||
|
||||
close(fds[1]);
|
||||
fatal_signal_fork();
|
||||
if (read(fds[0], &c, 1) != 1) {
|
||||
if (read_fully(fds[0], &c, 1, &bytes_read) != 0) {
|
||||
int retval;
|
||||
int status;
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user