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>
This commit is contained in:
Donald Sharp 2016-09-09 16:01:27 -04:00
parent b8dfa54478
commit 03809024fd

View File

@ -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));