Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136756752
D8157.id21253.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8157.id21253.diff
View Options
Index: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
===================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
@@ -581,6 +581,7 @@
dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
{
va_list ap;
+ va_list ap2;
int n;
#ifndef illumos
@@ -605,11 +606,13 @@
len = dtp->dt_sprintf_buflen - len;
assert(len >= 0);
- if ((n = vsnprintf(buf, len, format, ap)) < 0)
+ va_copy(ap2, ap);
+ if ((n = vsnprintf(buf, len, format, ap2)) < 0)
n = dt_set_errno(dtp, errno);
+ va_end(ap2);
va_end(ap);
-
+
return (n);
}
@@ -640,11 +643,14 @@
dtp->dt_buffered_buf[0] = '\0';
}
- if ((needed = vsnprintf(NULL, 0, format, ap)) < 0) {
+ va_copy(ap2, ap);
+ if ((needed = vsnprintf(NULL, 0, format, ap2)) < 0) {
rval = dt_set_errno(dtp, errno);
+ va_end(ap2);
va_end(ap);
return (rval);
}
+ va_end(ap2);
if (needed == 0) {
va_end(ap);
@@ -670,12 +676,15 @@
dtp->dt_buffered_size <<= 1;
}
+ va_copy(ap2, ap);
if (vsnprintf(&dtp->dt_buffered_buf[dtp->dt_buffered_offs],
- avail, format, ap) < 0) {
+ avail, format, ap2) < 0) {
rval = dt_set_errno(dtp, errno);
+ va_end(ap2);
va_end(ap);
return (rval);
}
+ va_end(ap2);
dtp->dt_buffered_offs += needed;
assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0');
@@ -683,8 +692,10 @@
return (0);
}
- n = vfprintf(fp, format, ap);
+ va_copy(ap2, ap);
+ n = vfprintf(fp, format, ap2);
fflush(fp);
+ va_end(ap2);
va_end(ap);
if (n < 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 20, 7:41 AM (3 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25637038
Default Alt Text
D8157.id21253.diff (1 KB)
Attached To
Mode
D8157: Corrected non-portable reuse of va_list in dt_printf()
Attached
Detach File
Event Timeline
Log In to Comment