summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fopen.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/fopen.c
parent90dad97fc07f049383903a166631e2c257f9b8c1 (diff)
Added c11 threads, fixed some locks and add *_unlocked functions
Diffstat (limited to 'lib/libc/stdio/fopen.c')
-rw-r--r--lib/libc/stdio/fopen.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c
index 5415e711..0265694a 100644
--- a/lib/libc/stdio/fopen.c
+++ b/lib/libc/stdio/fopen.c
@@ -8,10 +8,6 @@
#include <sys/cdefs.h>
#include <unistd.h> // for close
-__weak void __stdio_cleanup(void)
-{
-}
-
FILE *fopen(const char *restrict pathname, const char *restrict mode)
{
int fd, flags, _mode;
@@ -42,15 +38,15 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
if (stream == NULL)
return NULL;
- __FILE(stream)->fd = fd;
- __FILE(stream)->buf_size = BUFSIZ;
- __FILE(stream)->flags = flags;
- __FILE(stream)->type = _IOLBF;
- atomic_flag_clear(&__FILE(stream)->lock);
+ stream->fd = fd;
+ stream->buf_size = BUFSIZ;
+ stream->flags = flags;
+ stream->type = _IOLBF;
+ atomic_flag_clear(&stream->lock);
- __FILE(stream)->buf = malloc(BUFSIZ);
+ stream->buf = malloc(BUFSIZ);
- if (__FILE(stream)->buf == NULL) {
+ if (stream->buf == NULL) {
close(fd);
free(stream);
return NULL;