]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Complain loudly if the logging buffer would overflow.
authorMartin Mares <mj@ucw.cz>
Mon, 16 Nov 1998 21:41:21 +0000 (21:41 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 16 Nov 1998 21:41:21 +0000 (21:41 +0000)
sysdep/unix/log.c

index b9077c74b6977b54c480c19e4f816756efcd2080..00589a3c53c6255e6c985658f31800be5457062b 100644 (file)
@@ -50,8 +50,11 @@ bvfprintf(FILE *f, char *fmt, va_list args)
   char buf[4096];
   int n;
 
-  n = bvsprintf(buf, fmt, args);
-  fwrite(buf, n, sizeof(char), f);
+  n = bvsnprintf(buf, sizeof(buf), fmt, args);
+  if (n >= 0)
+    fwrite(buf, n, sizeof(char), f);
+  else
+    fprintf(stderr, "BIRD: warning: logging buffer overflow!\n");
 }
 
 static void