int fds[2];
pid_t pid;
- if (pipe(fds) < 0) {
- ovs_fatal(errno, "pipe failed");
- }
+ xpipe(fds);
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;
exit(WEXITSTATUS(status));
}
- ovs_fatal(errno, "fork child failed to signal startup");
+ VLOG_FATAL("fork child failed to signal startup (%s)",
+ strerror(errno));
}
close(fds[0]);
*fdp = -1;
lockfile_postfork();
*fdp = fds[1];
} else {
- ovs_fatal(errno, "could not fork");
+ VLOG_FATAL("fork failed (%s)", strerror(errno));
}
return pid;
error = write_fully(fd, "", 1, &bytes_written);
if (error) {
- ovs_fatal(error, "could not write to pipe");
+ VLOG_FATAL("pipe write failed (%s)", strerror(error));
}
close(fd);
} while (retval == -1 && errno == EINTR);
if (retval == -1) {
- ovs_fatal(errno, "waitpid failed");
+ VLOG_FATAL("waitpid failed (%s)", strerror(errno));
} else if (retval == daemon_pid) {
char *s = process_status_msg(status);
if (should_restart(status)) {