X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdaemon.c;h=3dd5a1abbf9ed1b4204ffeef2015301ac7bd2d68;hb=17f7f7e02cfd44dc7755fbebcfb942c07f937858;hp=ef1a24ef1e350a0a65e8a93052d468cae1bced1e;hpb=c1a543a8d6d2847983b6b0defd1e19777da85715;p=openvswitch diff --git a/lib/daemon.c b/lib/daemon.c index ef1a24ef..3dd5a1ab 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -250,16 +250,21 @@ fork_and_wait_for_startup(int *fdp) retval = waitpid(pid, &status, 0); } while (retval == -1 && errno == EINTR); - if (retval == pid - && WIFEXITED(status) - && WEXITSTATUS(status)) { - /* Child exited with an error. Convey the same error to - * our parent process as a courtesy. */ - exit(WEXITSTATUS(status)); + if (retval == pid) { + if (WIFEXITED(status) && WEXITSTATUS(status)) { + /* Child exited with an error. Convey the same error + * to our parent process as a courtesy. */ + exit(WEXITSTATUS(status)); + } else { + char *status_msg = process_status_msg(status); + VLOG_FATAL("fork child died before signaling startup (%s)", + status_msg); + } + } else if (retval < 0) { + VLOG_FATAL("waitpid failed (%s)", strerror(errno)); + } else { + NOT_REACHED(); } - - VLOG_FATAL("fork child failed to signal startup (%s)", - strerror(errno)); } close(fds[0]); *fdp = -1;