From 03809024fddcb94a020f2f6d9eb8dff8210e3b21 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 9 Sep 2016 16:01:27 -0400 Subject: [PATCH] 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 --- bgpd/bgp_main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 20fa138ce8..54e7329772 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)); -- 2.39.5