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;
break
if len(s) != 1:
retval, status = _waitpid(pid, 0)
- if (retval == pid and
- os.WIFEXITED(status) and os.WEXITSTATUS(status)):
- # Child exited with an error. Convey the same error to
- # our parent process as a courtesy.
- sys.exit(os.WEXITSTATUS(status))
+ if retval == pid:
+ if os.WIFEXITED(status) and os.WEXITSTATUS(status):
+ # Child exited with an error. Convey the same error to
+ # our parent process as a courtesy.
+ sys.exit(os.WEXITSTATUS(status))
+ else:
+ sys.stderr.write("fork child failed to signal "
+ "startup (%s)\n"
+ % ovs.process.status_msg(status))
else:
- sys.stderr.write("fork child failed to signal startup\n")
+ assert retval < 0
+ sys.stderr.write("waitpid failed (%s)\n"
+ % os.strerror(-retval))
sys.exit(1)
os.close(rfd)