summaryrefslogtreecommitdiff
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
commiteb820afe3b53321624317cfa6b426ecae1392f24 (patch)
tree55557a19a1918bdca547c3a3d0e7f6c7802b78b4 /lib/command.c
parentc89c05dd04d097bd8213125a42d67204bb681de5 (diff)
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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c
index f6423595..2b7ca9ad 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1,5 +1,5 @@
/*
- $Id: command.c,v 1.49 2005/08/22 22:39:56 paul Exp $
+ $Id: command.c,v 1.50 2005/09/05 11:54:13 paul Exp $
Command interpreter routine for virtual terminal [aka TeletYpe]
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
@@ -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)