diff options
author | Anton Kling <anton@kling.gg> | 2024-06-22 21:41:46 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-06-22 21:41:46 +0200 |
commit | 5fbd9b519e082fc235a8a57c6cf761e6cefbfb62 (patch) | |
tree | d9df62f8bf6ed6b17a7b61aa77f61da9d097c5ff /userland/libc/stdio/stdin.c | |
parent | 5e10cdd5b4aa7486208dd14ebef4254ec5b5d03a (diff) |
LibC: Fix bugs relating to fseek
Diffstat (limited to 'userland/libc/stdio/stdin.c')
-rw-r--r-- | userland/libc/stdio/stdin.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/userland/libc/stdio/stdin.c b/userland/libc/stdio/stdin.c index fcfc71e..e497167 100644 --- a/userland/libc/stdio/stdin.c +++ b/userland/libc/stdio/stdin.c @@ -71,10 +71,13 @@ size_t read_fd(FILE *f, unsigned char *s, size_t l) { f->read_buffer_has_read += read_len; s += read_len; l -= read_len; + lseek(f->fd, read_len, SEEK_CUR); return read_len + read_fd(f, s, l); } if (0 == f->read_buffer_stored) { + int offset = lseek(f->fd, 0, SEEK_CUR); f->read_buffer_stored = non_cache_read_fd(f, f->read_buffer, 4096); + lseek(f->fd, offset, SEEK_SET); f->read_buffer_has_read = 0; if (0 == f->read_buffer_stored) { return 0; |