diff options
author | Paul Jakma <paul.jakma@sun.com> | 2006-05-28 08:18:38 +0000 |
---|---|---|
committer | Paul Jakma <paul.jakma@sun.com> | 2006-05-28 08:18:38 +0000 |
commit | a4b303038363185f60dfef7023cb02715a9a4315 (patch) | |
tree | 1eea12d93c580da94af435666428a7a02e67da8e /lib/vty.c | |
parent | d09552d0c7d389f83c3833bf82f7a97da37007da (diff) |
[lib] vty_log shouldn't crash if called when vty isn't initiliased
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.
Diffstat (limited to 'lib/vty.c')
-rw-r--r-- | lib/vty.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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"; |