From 5c9ab75dbc119d2fd381a95cd3e044c8b58e961e Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 19 Jul 2026 13:27:57 +0100 Subject: [PATCH] libc: io: fix ringbuf_read/write not returning the correct values --- lib/libc/io/stdio/ringbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/io/stdio/ringbuf.c b/lib/libc/io/stdio/ringbuf.c index 59255e5..03411f7 100644 --- a/lib/libc/io/stdio/ringbuf.c +++ b/lib/libc/io/stdio/ringbuf.c @@ -145,7 +145,7 @@ long __libc_ringbuf_read(struct ringbuf *buf, void *p, size_t count) memcpy(dest, src, to_copy); - nr_read += available; + nr_read += to_copy; __libc_ringbuf_put_read_buffer(buf, &src, &to_copy); } @@ -183,7 +183,7 @@ long __libc_ringbuf_write(struct ringbuf *buf, const void *p, size_t count) memcpy(dest, src, to_copy); - nr_written += available; + nr_written += to_copy; __libc_ringbuf_put_write_buffer(buf, &dest, &to_copy); }