diff options
Diffstat (limited to 'linux/printbuf_userspace.c')
-rw-r--r-- | linux/printbuf_userspace.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/linux/printbuf_userspace.c b/linux/printbuf_userspace.c index 84187f1f..df9567c5 100644 --- a/linux/printbuf_userspace.c +++ b/linux/printbuf_userspace.c @@ -2,15 +2,15 @@ #include <stdio.h> #include <linux/printbuf.h> -void prt_printf(struct printbuf *out, const char *fmt, ...) +void prt_vprintf(struct printbuf *out, const char *fmt, va_list args) { - va_list args; int len; do { - va_start(args, fmt); - len = vsnprintf(out->buf + out->pos, printbuf_remaining(out), fmt, args); - va_end(args); + va_list args2; + + va_copy(args2, args); + len = vsnprintf(out->buf + out->pos, printbuf_remaining(out), fmt, args2); } while (len + 1 >= printbuf_remaining(out) && !printbuf_make_room(out, len + 1)); @@ -18,3 +18,12 @@ void prt_printf(struct printbuf *out, const char *fmt, ...) printbuf_remaining(out) ? printbuf_remaining(out) - 1 : 0); out->pos += len; } + +void prt_printf(struct printbuf *out, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + prt_vprintf(out, fmt, args); + va_end(args); +} |