summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util.c b/util.c
index f935fac..cc2da65 100644
--- a/util.c
+++ b/util.c
@@ -92,11 +92,13 @@ bool safe_strtol(const char *str, int32_t *out) {
void vperror(const char *fmt, ...) {
int old_errno = errno;
- char buf[80];
+ char buf[1024];
va_list ap;
va_start(ap, fmt);
- vsnprintf(buf, sizeof(buf), fmt, ap);
+ if (vsnprintf(buf, sizeof(buf), fmt, ap) == -1) {
+ buf[sizeof(buf) - 1] = '\0';
+ }
va_end(ap);
errno = old_errno;