summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_main.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-09-09 22:01:27 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-09 22:01:27 +0200
commit03809024fddcb94a020f2f6d9eb8dff8210e3b21 (patch)
tree41ea190f4eae9fa4ef905a834cee56590a4da76a /bgpd/bgp_main.c
parentospfd: Fix crash with usage of incorrect command (diff)
downloadfrr-03809024fddcb94a020f2f6d9eb8dff8210e3b21.tar.xz
frr-03809024fddcb94a020f2f6d9eb8dff8210e3b21.zip
bgpd: Fix startup a bit more
There were several issues here. The zprivs_init is being called *before* the cli is read in to influence the user we are running as. This needs to be rectified. Additionally we need to move the log creation till after cli arguments are read. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r--bgpd/bgp_main.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 20fa138ce..54e732977 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -415,13 +415,6 @@ main (int argc, char **argv)
/* Preserve name of myself. */
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
- zlog_default = openzlog (progname, ZLOG_BGP, 0,
- LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
- zprivs_init (&bgpd_privs);
-#if defined(HAVE_CUMULUS)
- zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
-#endif
-
/* BGP master init. */
bgp_master_init ();
@@ -502,6 +495,12 @@ main (int argc, char **argv)
}
}
+ zlog_default = openzlog (progname, ZLOG_BGP, 0,
+ LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON);
+ zprivs_init (&bgpd_privs);
+#if defined(HAVE_CUMULUS)
+ zlog_set_level (NULL, ZLOG_DEST_SYSLOG, zlog_default->default_lvl);
+#endif
/* Initializations. */
srandom (time (NULL));