summaryrefslogtreecommitdiffstats
path: root/sbin/dump
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2003-09-21 22:14:49 +0000
committerps <ps@FreeBSD.org>2003-09-21 22:14:49 +0000
commitab421423b9cf4ea5266ba7d8ff582124348976e8 (patch)
tree2b9475322f8a03608ac0dc8cf31a985a731b6b11 /sbin/dump
parentd94df47be52e616ee9b6bbf3968524034a2642d4 (diff)
downloadFreeBSD-src-ab421423b9cf4ea5266ba7d8ff582124348976e8.zip
FreeBSD-src-ab421423b9cf4ea5266ba7d8ff582124348976e8.tar.gz
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
Diffstat (limited to 'sbin/dump')
-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 97b7438..d039a95 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
OpenPOWER on IntegriCloud