summaryrefslogtreecommitdiff
path: root/bgpd/bgp_main.c
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-05-15 10:29:41 -0700
committerPaul Jakma <paul@quagga.net>2009-06-18 20:18:30 +0100
commit372b3c70a090359fe401dbb5e7c34ff8ae09f757 (patch)
treeca77aa42206f79326327fe061af90370e9811180 /bgpd/bgp_main.c
parentce0db9cb11c0bc2e7f89a7d042e50afa495556b4 (diff)
[BGP/cleanup] main program cleanup
Check result of daemon() call to fix warning Make local variables static
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r--bgpd/bgp_main.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 2089c6b5..620ca128 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -37,7 +37,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_mplsvpn.h"
/* bgpd options, we use GNU getopt library. */
-struct option longopts[] =
+static const struct option longopts[] =
{
{ "daemon", no_argument, NULL, 'd'},
{ "config_file", required_argument, NULL, 'f'},
@@ -61,7 +61,7 @@ void sighup (void);
void sigint (void);
void sigusr1 (void);
-struct quagga_signal_t bgp_signals[] =
+static struct quagga_signal_t bgp_signals[] =
{
{
.signal = SIGHUP,
@@ -85,7 +85,7 @@ struct quagga_signal_t bgp_signals[] =
char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
/* Route retain mode flag. */
-int retain_mode = 0;
+static int retain_mode = 0;
/* Master of threads. */
struct thread_master *master;
@@ -94,14 +94,14 @@ struct thread_master *master;
char *config_file = NULL;
/* Process ID saved for use by init system */
-const char *pid_file = PATH_BGPD_PID;
+static const char *pid_file = PATH_BGPD_PID;
/* VTY port number and address. */
int vty_port = BGP_VTY_PORT;
char *vty_addr = NULL;
/* privileges */
-zebra_capabilities_t _caps_p [] =
+static zebra_capabilities_t _caps_p [] =
{
ZCAP_BIND,
ZCAP_NET_RAW,
@@ -316,8 +316,12 @@ main (int argc, char **argv)
return(0);
/* Turn into daemon if daemon_mode is set. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("BGPd daemon failed: %s", strerror(errno));
+ return (1);
+ }
+
/* Process ID file creation. */
pid_output (pid_file);