summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ferror.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/ferror.c
parent90dad97fc07f049383903a166631e2c257f9b8c1 (diff)
Added c11 threads, fixed some locks and add *_unlocked functions
Diffstat (limited to 'lib/libc/stdio/ferror.c')
-rw-r--r--lib/libc/stdio/ferror.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/stdio/ferror.c b/lib/libc/stdio/ferror.c
index 5e4b8dc4..9391a44a 100644
--- a/lib/libc/stdio/ferror.c
+++ b/lib/libc/stdio/ferror.c
@@ -1,12 +1,12 @@
-#include "__stdio.h" // for __FILE, _IO_ERR
-#include "stddef.h" // for NULL
-
-#include <stdio.h> // for FILE, ferror
+#include <stdio.h>
int ferror(FILE *stream)
{
- if (stream == NULL)
- return 0;
+ int r;
+
+ flockfile(stream);
+ r = ferror_unlocked(stream);
+ funlockfile(stream);
- return (__FILE(stream)->flags & _IO_ERR) != 0;
+ return r;
}