aboutsummaryrefslogtreecommitdiff
path: root/lib/daemon.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-12-18 13:46:33 -0800
committerBen Pfaff <blp@nicira.com>2010-01-04 09:47:01 -0800
commitb8781ff08d9981258e75789c6f4ed18a56991577 (patch)
tree10d04a8b00a1f5b44606d1f0fbe9601704ede9b5 /lib/daemon.c
parent7f1bfcfe29a4dd09afbcef22dbb66da3e1d979d9 (diff)
daemon: Don't ignore failed write to pipe.
If the write to the pipe fails here then the parent will think that the child failed to start up, so the child should oblige it by bailing out.
Diffstat (limited to 'lib/daemon.c')
-rw-r--r--lib/daemon.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/daemon.c b/lib/daemon.c
index c4effa9b..9a1be55d 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -25,6 +25,7 @@
#include "fatal-signal.h"
#include "dirs.h"
#include "lockfile.h"
+#include "socket-util.h"
#include "timeval.h"
#include "util.h"
@@ -280,9 +281,14 @@ void
daemonize_complete(void)
{
if (detach) {
- char c = 0;
+ size_t bytes_written;
+ int error;
+
+ error = write_fully(daemonize_fds[1], "", 1, &bytes_written);
+ if (error) {
+ ovs_fatal(error, "could not write to pipe");
+ }
- ignore(write(daemonize_fds[1], &c, 1));
close(daemonize_fds[1]);
setsid();
if (chdir_) {