summaryrefslogtreecommitdiff
path: root/usr.bin/mg/buffer.c
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-02-21 00:04:11 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2002-02-21 00:04:11 +0000
commit93a362e9e69dbaf4b393b265f1e781da23c4b907 (patch)
tree1a33fa0ec75312d2977dc03f6eb4e2d910928f7c /usr.bin/mg/buffer.c
parent873353c43ad6796218ad86aca7f8a65b52e0fa79 (diff)
It seems you need to have hacked mg at some point to be considered a
true old fart, so here's my contribution ;) Don't use the same va_list twice without re-va_start()ing it, doesn't work on macppc.
Diffstat (limited to 'usr.bin/mg/buffer.c')
-rw-r--r--usr.bin/mg/buffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index 81d37423c8e..f1500f6a28a 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.22 2002/02/16 21:27:49 millert Exp $ */
+/* $OpenBSD: buffer.c,v 1.23 2002/02/21 00:04:10 dhartmei Exp $ */
/*
* Buffer handling.
@@ -343,15 +343,18 @@ addlinef(BUFFER *bp, char *fmt, ...)
char dummy[1];
va_start(ap, fmt);
- ntext = vsnprintf(dummy, 1, fmt, ap) + 1;
+ ntext = vsnprintf(dummy, 1, fmt, ap);
if (ntext == -1) {
va_end(ap);
return FALSE;
}
+ ntext++;
if ((lp = lalloc(ntext)) == NULL) {
va_end(ap);
return FALSE;
}
+ va_end(ap);
+ va_start(ap, fmt);
vsnprintf(lp->l_text, ntext, fmt, ap);
lp->l_used--;
va_end(ap);