From 74ff9579f3171cb0927e2f5afa2ad908413ce5ca Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Sat, 22 Feb 2025 02:43:06 +0200 Subject: [PATCH] fix(userspace/libc): fopen should set buffer_pos to -1 This change is a fix for fread() because it needs to pass the if statement: "if (stream->buffer_pos >= stream->buffer_size)" Signed-off-by: EnderIce2 --- Userspace/libc/src/std/stdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userspace/libc/src/std/stdio.c b/Userspace/libc/src/std/stdio.c index aeb77e3a..38820c70 100644 --- a/Userspace/libc/src/std/stdio.c +++ b/Userspace/libc/src/std/stdio.c @@ -217,7 +217,7 @@ export FILE *fopen(const char *restrict pathname, const char *restrict mode) file->fd = fd; file->buffer = malloc(4096); file->buffer_size = 4096; - file->buffer_pos = 0; + file->buffer_pos = -1; file->flags = flags; file->error = 0; file->eof = 0;