about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-01-31 22:22:02 +0100
committerFlorian Weimer <fweimer@redhat.com>2023-01-31 22:22:02 +0100
commitf5c65fa920d78cffe56fe4065f16241637808353 (patch)
tree0265b2fc8b7f69e366f418a86b3eb0976ea24300 /libio
parent2f39e44a8417b4186a7f15bfeac5d0b557e63e03 (diff)
downloadglibc-f5c65fa920d78cffe56fe4065f16241637808353.tar.gz
glibc-f5c65fa920d78cffe56fe4065f16241637808353.tar.xz
glibc-f5c65fa920d78cffe56fe4065f16241637808353.zip
libio: Update number of written bytes in dprintf implementation
The __printf_buffer_flush_dprintf function needs to record that
the buffer has been written before reusing it.  Without this
accounting, dprintf always returns zero.

Fixes commit 8ece45e4f586abd212d1c02d74d38ef681a45600
("libio: Convert __vdprintf_internal to buffers").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'libio')
-rw-r--r--libio/iovdprintf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c
index fb359d263d..d9fa886fdf 100644
--- a/libio/iovdprintf.c
+++ b/libio/iovdprintf.c
@@ -54,6 +54,7 @@ __printf_buffer_flush_dprintf (struct __printf_buffer_dprintf *buf)
 	}
       p += ret;
     }
+  buf->base.written += buf->base.write_ptr - buf->base.write_base;
   buf->base.write_ptr = buf->buf;
 }