From 4fc4e7ab47fef3295d0ae40e064fc99478c24e23 Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 22 Jan 2003 19:47:09 +0000 Subject: Matthew Grant [zebra 17290] [PATCHES] - Fixes for problems in 0.93b portfix patch --- ospfd/ospf_main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'ospfd/ospf_main.c') diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 82960b24..6f6262aa 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -170,7 +170,7 @@ main (int argc, char **argv) { char *p; char *vty_addr = NULL; - int vty_port = 0; + int vty_port = OSPF_VTY_PORT; int daemon_mode = 0; char *config_file = NULL; char *progname; @@ -219,8 +219,16 @@ main (int argc, char **argv) pid_file = optarg; break; case 'P': - vty_port = atoi (optarg); - break; + /* Deal with atoi() returning 0 on failure, and ospfd not + listening on ospfd port... */ + if (strcmp(optarg, "0") == 0) + { + vty_port = 0; + break; + } + vty_port = atoi (optarg); + vty_port = (vty_port ? vty_port : OSPF_VTY_PORT); + break; case 'v': print_version (progname); exit (0); @@ -277,8 +285,7 @@ main (int argc, char **argv) pid_output (pid_file); /* Create VTY socket */ - vty_serv_sock (vty_addr, - vty_port ? vty_port : OSPF_VTY_PORT, OSPF_VTYSH_PATH); + vty_serv_sock (vty_addr, vty_port, OSPF_VTYSH_PATH); /* Print banner. */ zlog (NULL, LOG_INFO, "OSPFd (%s) starts", ZEBRA_VERSION); -- cgit v1.2.1