X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdaemon.c;h=3dd5a1abbf9ed1b4204ffeef2015301ac7bd2d68;hb=431d6a6acf6da61ecfeb433cb1fb10e1b39e9773;hp=f4151ab1253238b08262a24724f3680b62cfda2c;hpb=d3824212ada08ae285ac2e4f05dc30d97a7c25ad;p=openvswitch diff --git a/lib/daemon.c b/lib/daemon.c index f4151ab1..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; @@ -410,7 +415,7 @@ close_standard_fds(void) } /* Disable logging to stderr to avoid wasting CPU time. */ - vlog_set_levels(NULL, VLF_CONSOLE, VLL_EMER); + vlog_set_levels(NULL, VLF_CONSOLE, VLL_OFF); } /* If daemonization is configured, then starts daemonization, by forking and