aboutsummaryrefslogtreecommitdiff
path: root/sbin/dump/optr.c
diff options
context:
space:
mode:
authorPaul Saab <ps@FreeBSD.org>2003-09-21 22:14:49 +0000
committerPaul Saab <ps@FreeBSD.org>2003-09-21 22:14:49 +0000
commit4036f9e297d7e7c0890ca6c2ce68f4e98f984844 (patch)
tree2b9475322f8a03608ac0dc8cf31a985a731b6b11 /sbin/dump/optr.c
parentbe19fdd17e4d600c7fd6eac87daec3c419dff34d (diff)
downloadsrc-4036f9e297d7e7c0890ca6c2ce68f4e98f984844.tar.gz
src-4036f9e297d7e7c0890ca6c2ce68f4e98f984844.zip
revert to version 1.25 and use va_copy to obtain another copy of the
variable arguments. version 1.26 incorrectly truncated the message if the buffer was too long. Requested by: bde
Notes
Notes: svn path=/head/; revision=120323
Diffstat (limited to 'sbin/dump/optr.c')
-rw-r--r--sbin/dump/optr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c
index 97b74381daef..d039a95078ce 100644
--- a/sbin/dump/optr.c
+++ b/sbin/dump/optr.c
@@ -227,17 +227,20 @@ void
msg(const char *fmt, ...)
{
va_list ap;
+ va_list ap2;
(void) fprintf(stderr," DUMP: ");
#ifdef TDEBUG
(void) fprintf(stderr, "pid=%d ", getpid());
#endif
va_start(ap, fmt);
- (void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap);
- (void) fprintf(stderr, lastmsg);
+ va_copy(ap2, ap);
+ (void) vfprintf(stderr, fmt, ap);
(void) fflush(stdout);
(void) fflush(stderr);
+ (void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap2);
va_end(ap);
+ va_end(ap2);
}
void