summaryrefslogtreecommitdiff
path: root/zebra/main.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-07 11:13:49 -0700
committerPaul Jakma <paul@quagga.net>2009-08-13 10:21:13 +0100
commit065de90380c88d9fcc116627f714bed9984c2723 (patch)
tree79061a2699e0dc3e87c218b3b57c2f0577d5a69a /zebra/main.c
parent5bd5881838c22e075c3d0c245a8952a55e9dca38 (diff)
all: check return value from daemon() call
* */*main.c: (main) Current versions of Gcc warn if the return value for daemon() is not checked. So add a simple test and exit on failure.
Diffstat (limited to 'zebra/main.c')
-rw-r--r--zebra/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/zebra/main.c b/zebra/main.c
index 2d6a4ac8..d829c046 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -362,8 +362,11 @@ main (int argc, char **argv)
exit (0);
/* Daemonize. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("Zebra daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* Output pid of zebra. */
pid_output (pid_file);