summaryrefslogtreecommitdiffstats
path: root/lib/command.c
diff options
context:
space:
mode:
authorpaul <paul>2005-09-05 11:54:13 +0000
committerpaul <paul>2005-09-05 11:54:13 +0000
commit3549bbffe2ad2754c9aeee8b4c43e5a3671e7c73 (patch)
tree445de85f03f4191d5f25ffc715613a8946ee858a /lib/command.c
parentb0d9f73370752e12a68872b5bd2cce17e23afac1 (diff)
downloadquagga-3549bbffe2ad2754c9aeee8b4c43e5a3671e7c73.tar.bz2
quagga-3549bbffe2ad2754c9aeee8b4c43e5a3671e7c73.tar.xz
2005-09-05 Paul Jakma <paul.jakma@sun.com>
* command.c: (install_element) be more robust. Eg, cmd_init need not have been called, some applications may use other library subsystems, which call install_element, without the application wanting commands and hence not calling cmd_init.
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index a6338d5b..84da917c 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -35,7 +35,7 @@ Boston, MA 02111-1307, USA. */
/* Command vector which includes some level of command lists. Normally
each daemon maintains each own cmdvec. */
-vector cmdvec;
+vector cmdvec = NULL;
/* Host information structure. */
struct host host;
@@ -475,7 +475,11 @@ void
install_element (enum node_type ntype, struct cmd_element *cmd)
{
struct cmd_node *cnode;
-
+
+ /* cmd_init hasn't been called */
+ if (!cmdvec)
+ return;
+
cnode = vector_slot (cmdvec, ntype);
if (cnode == NULL)