]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - linux/printbuf_userspace.c
Update bcachefs sources to 24c6361e20 bcachefs: Fix a trans path overflow in bch2_btr...
[bcachefs-tools-debian] / linux / printbuf_userspace.c
index 84187f1f68be7e6a9bdf08836dd74fb20d2050ea..df9567c5f5a9270933d605cc02f4c42d2f4b8fcd 100644 (file)
@@ -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);
+}