summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isisd/isis_main.c7
-rw-r--r--ospf6d/ospf6_main.c7
-rw-r--r--ospfd/ospf_main.c7
-rw-r--r--ripd/rip_main.c7
-rw-r--r--ripngd/ripng_main.c7
-rw-r--r--tests/main.c7
-rw-r--r--watchquagga/watchquagga.c6
-rw-r--r--zebra/main.c7
-rw-r--r--zebra/test_main.c7
9 files changed, 45 insertions, 17 deletions
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index 2411518d..c5e824c1 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -333,8 +333,11 @@ main (int argc, char **argv, char **envp)
return(0);
/* demonize */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("ISISd daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* Process ID file creation. */
pid_output (pid_file);
diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c
index 73d9150e..a7a96a1f 100644
--- a/ospf6d/ospf6_main.c
+++ b/ospf6d/ospf6_main.c
@@ -282,8 +282,11 @@ main (int argc, char *argv[], char *envp[])
if (dryrun)
return(0);
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("OSPF6d daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* pid file create */
pid_output (pid_file);
diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c
index 2dd997e8..8b9a3458 100644
--- a/ospfd/ospf_main.c
+++ b/ospfd/ospf_main.c
@@ -314,8 +314,11 @@ main (int argc, char **argv)
return(0);
/* Change to the daemon program. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("OSPFd daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* Process id file create. */
pid_output (pid_file);
diff --git a/ripd/rip_main.c b/ripd/rip_main.c
index 0b29107d..57b5f3af 100644
--- a/ripd/rip_main.c
+++ b/ripd/rip_main.c
@@ -292,8 +292,11 @@ main (int argc, char **argv)
return (0);
/* Change to the daemon program. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("RIPd daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* Pid file create. */
pid_output (pid_file);
diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c
index f174610d..85209a15 100644
--- a/ripngd/ripng_main.c
+++ b/ripngd/ripng_main.c
@@ -288,8 +288,11 @@ main (int argc, char **argv)
return(0);
/* Change to the daemon program. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("RIPNGd daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* Create VTY socket */
vty_serv_sock (vty_addr, vty_port, RIPNG_VTYSH_PATH);
diff --git a/tests/main.c b/tests/main.c
index edc3b2de..e0fbb4d5 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -174,8 +174,11 @@ main (int argc, char **argv)
sort_node ();
/* Change to the daemon program. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ fprintf(stderr, "daemon failed: %s", strerror(errno));
+ exit (1);
+ }
/* Create VTY socket */
vty_serv_sock (vty_addr, vty_port, "/tmp/.heavy.sock");
diff --git a/watchquagga/watchquagga.c b/watchquagga/watchquagga.c
index f4c483cf..fb628acc 100644
--- a/watchquagga/watchquagga.c
+++ b/watchquagga/watchquagga.c
@@ -1343,7 +1343,11 @@ main(int argc, char **argv)
if (daemon_mode)
{
zlog_set_level(NULL, ZLOG_DEST_SYSLOG, MIN(gs.loglevel,LOG_DEBUG));
- daemon(0, 0);
+ if (daemon (0, 0) < 0)
+ {
+ fprintf(stderr, "Watchquagga daemon failed: %s", strerror(errno));
+ exit (1);
+ }
}
else
zlog_set_level(NULL, ZLOG_DEST_STDOUT, MIN(gs.loglevel,LOG_DEBUG));
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);
diff --git a/zebra/test_main.c b/zebra/test_main.c
index e186fea6..4398a389 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -308,8 +308,11 @@ main (int argc, char **argv)
exit (0);
/* Daemonize. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ perror("daemon start failed");
+ exit (1);
+ }
/* Needed for BSD routing socket. */
pid = getpid ();