]> git.puffer.fish Git - mirror/frr.git/commitdiff
[lib] vty_log shouldn't crash if called when vty isn't initiliased
authorPaul Jakma <paul.jakma@sun.com>
Sun, 28 May 2006 08:18:38 +0000 (08:18 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Sun, 28 May 2006 08:18:38 +0000 (08:18 +0000)
2006-05-28 Paul Jakma <paul.jakma@sun.com>

* vty.c: (vty_log/vty_log_fixed) dont crash if called when vty
  hasn't been initiliased.

lib/ChangeLog
lib/vty.c

index 08131b031ae609bd2fbb5945266d3c9d9846eec4..90ddd07e0fa7da77728b5523d2a3233d0d26e50d 100644 (file)
@@ -5,6 +5,8 @@
          Add UINT*_MAX defines for older platforms lacking these (FBSD 4)
        * memory.c: malloc.h is deprecated in favour of stdlib.h, however
          we still need it on GNU Libc for mallinfo().
+       * vty.c: (vty_log/vty_log_fixed) dont crash if called when vty
+         hasn't been initiliased.
 
 2006-05-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
 
index 7696915a75620733184fae1c30eb62ab30796116..b037c70cc540879bf03de03b428c50334423e0d9 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2404,6 +2404,9 @@ vty_log (const char *level, const char *proto_str,
 {
   unsigned int i;
   struct vty *vty;
+  
+  if (!vtyvec)
+    return;
 
   for (i = 0; i < vector_active (vtyvec); i++)
     if ((vty = vector_slot (vtyvec, i)) != NULL)
@@ -2423,6 +2426,10 @@ vty_log_fixed (const char *buf, size_t len)
   unsigned int i;
   struct iovec iov[2];
 
+  /* vty may not have been initialised */
+  if (!vtyvec)
+    return;
+  
   iov[0].iov_base = (void *)buf;
   iov[0].iov_len = len;
   iov[1].iov_base = (void *)"\r\n";