summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fseek.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-22 23:27:56 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-22 23:30:32 +0100
commit0f30d227497418c6d3bef7d52244407e30454504 (patch)
tree0e1ac19623d3268380cf74328cdf643648a2f43c /lib/libc/stdio/fseek.c
parent90dad97fc07f049383903a166631e2c257f9b8c1 (diff)
Added c11 threads, fixed some locks and add *_unlocked functions
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r--lib/libc/stdio/fseek.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index 7a6754f7..19459e7f 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -7,24 +7,21 @@
int fseek(FILE *stream, long offset, int whence)
{
- if (stream == NULL || __FILE(stream)->fd < 0)
+ if (stream == NULL || stream->fd < 0)
return -1;
- LIBC_LOCK(__FILE(stream)->lock);
+ stream->buf_pos = 0;
+ stream->buf_len = 0;
+ stream->flags &= ~_IO_EOF;
- __FILE(stream)->buf_pos = 0;
- __FILE(stream)->buf_len = 0;
- __FILE(stream)->flags &= ~_IO_EOF;
-
- off_t result = lseek(__FILE(stream)->fd, offset, whence);
-
- LIBC_UNLOCK(__FILE(stream)->lock);
+ off_t result = lseek(stream->fd, offset, whence);
if (result == (off_t)-1) {
- __FILE(stream)->flags |= _IO_ERR;
+ stream->flags |= _IO_ERR;
return -1;
}
- __FILE(stream)->offset = result;
+ stream->offset = result;
+
return 0;
}