From 9158ca99f740d5b1b50d233e0f64e61504dc6fdf Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 16 Nov 1998 21:41:21 +0000 Subject: [PATCH] Complain loudly if the logging buffer would overflow. --- sysdep/unix/log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index b9077c74..00589a3c 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -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