mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-17 20:09:38 +00:00
[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.
This commit is contained in:
parent
d09552d0c7
commit
a4b3030383
@ -5,6 +5,8 @@
|
|||||||
Add UINT*_MAX defines for older platforms lacking these (FBSD 4)
|
Add UINT*_MAX defines for older platforms lacking these (FBSD 4)
|
||||||
* memory.c: malloc.h is deprecated in favour of stdlib.h, however
|
* memory.c: malloc.h is deprecated in favour of stdlib.h, however
|
||||||
we still need it on GNU Libc for mallinfo().
|
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>
|
2006-05-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
|
||||||
|
|
||||||
|
@ -2404,6 +2404,9 @@ vty_log (const char *level, const char *proto_str,
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct vty *vty;
|
struct vty *vty;
|
||||||
|
|
||||||
|
if (!vtyvec)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < vector_active (vtyvec); i++)
|
for (i = 0; i < vector_active (vtyvec); i++)
|
||||||
if ((vty = vector_slot (vtyvec, i)) != NULL)
|
if ((vty = vector_slot (vtyvec, i)) != NULL)
|
||||||
@ -2423,6 +2426,10 @@ vty_log_fixed (const char *buf, size_t len)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
|
|
||||||
|
/* vty may not have been initialised */
|
||||||
|
if (!vtyvec)
|
||||||
|
return;
|
||||||
|
|
||||||
iov[0].iov_base = (void *)buf;
|
iov[0].iov_base = (void *)buf;
|
||||||
iov[0].iov_len = len;
|
iov[0].iov_len = len;
|
||||||
iov[1].iov_base = (void *)"\r\n";
|
iov[1].iov_base = (void *)"\r\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user