X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdaemon%2Fcollectd.c;h=7b324e1e3a6513b47bf453e634c91bedfa831bea;hb=03f81fa2ddcd60a4bdc7ce78775554da2166fc70;hp=06125dce5fa97097e5be76178e89cf4bea3a193d;hpb=b333eb9557c96bdd2a336c33d623e428922a1046;p=collectd.git diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 06125dce..7b324e1e 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -638,6 +638,8 @@ int main (int argc, char **argv) #endif ) { + int status; + if ((pid = fork ()) == -1) { /* error */ @@ -666,19 +668,24 @@ int main (int argc, char **argv) close (1); close (0); - if (open ("/dev/null", O_RDWR) != 0) + status = open ("/dev/null", O_RDWR); + if (status != 0) { - ERROR ("Error: Could not connect `STDIN' to `/dev/null'"); + ERROR ("Error: Could not connect `STDIN' to `/dev/null' (status %d)", status); return (1); } - if (dup (0) != 1) + + status = dup (0); + if (status != 1) { - ERROR ("Error: Could not connect `STDOUT' to `/dev/null'"); + ERROR ("Error: Could not connect `STDOUT' to `/dev/null' (status %d)", status); return (1); } - if (dup (0) != 2) + + status = dup (0); + if (status != 2) { - ERROR ("Error: Could not connect `STDERR' to `/dev/null'"); + ERROR ("Error: Could not connect `STDERR' to `/dev/null', (status %d)", status); return (1); } } /* if (daemonize) */