diff options
author | 2002-02-21 00:04:10 +0000 | |
---|---|---|
committer | 2002-02-21 00:04:10 +0000 | |
commit | 6ccc637f1fcf0e191ee557c0f68f532c51dd6c70 (patch) | |
tree | 93df57ce1a2d0fd91fbab97ac0940168dd3468ee | |
parent | signal-safe window size changing (diff) | |
download | wireguard-openbsd-6ccc637f1fcf0e191ee557c0f68f532c51dd6c70.tar.xz wireguard-openbsd-6ccc637f1fcf0e191ee557c0f68f532c51dd6c70.zip |
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.
-rw-r--r-- | usr.bin/mg/buffer.c | 7 |
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); |