summaryrefslogtreecommitdiff
path: root/client/util.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-05-13 13:48:04 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-05-13 13:48:04 +0200
commit5af7b59660be615fbbd7c20b92b71321c003c43a (patch)
tree59bc962b18ae5a4ac6bf088863cfe210c9123b57 /client/util.c
parentd39d41fbda2ec86ea2bac27308eb4fb16ecc4702 (diff)
parentb66a9e2f3376b4cb07ef4cc318f70a9c794f407a (diff)
Merge branch 'int-new' of gitlab.labs.nic.cz:labs/bird into int-new
Diffstat (limited to 'client/util.c')
-rw-r--r--client/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/client/util.c b/client/util.c
index 050224b9..c35cf8f4 100644
--- a/client/util.c
+++ b/client/util.c
@@ -21,8 +21,11 @@ vlog(const char *msg, va_list args)
{
char buf[1024];
- if (bvsnprintf(buf, sizeof(buf)-1, msg, args) < 0)
- bsprintf(buf + sizeof(buf) - 100, " ... <too long>");
+ int n = vsnprintf(buf, sizeof(buf), msg, args);
+ if (n < 0)
+ snprintf(buf, sizeof(buf), "???");
+ if (n >= sizeof(buf))
+ snprintf(buf + sizeof(buf) - 100, 100, " ... <too long>");
fputs(buf, stderr);
fputc('\n', stderr);
}