aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaximilian attems <max@stro.at>2011-08-31 01:55:08 +0200
committermaximilian attems <max@stro.at>2011-08-31 01:56:06 +0200
commitc7dedd5d11b075b5e6cecd6aa82b70b748179121 (patch)
treef1917a72472a9a09ee31c2630eef7e81f483b04e
parentef573f1aed7bba670b3b519b5b61d93cde7e2957 (diff)
downloadklibc-c7dedd5d11b075b5e6cecd6aa82b70b748179121.tar.gz
[klibc] stdio: fix ferror()
Thanks to the stdio branch merge the error indicator of the stream can be tested against. Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/include/stdio.h7
-rw-r--r--usr/klibc/Kbuild2
-rw-r--r--usr/klibc/stdio/ferror.c6
3 files changed, 8 insertions, 7 deletions
diff --git a/usr/include/stdio.h b/usr/include/stdio.h
index eac9a09463d0e..69d80b30640f1 100644
--- a/usr/include/stdio.h
+++ b/usr/include/stdio.h
@@ -109,12 +109,7 @@ __extern int vsnprintf(char *, size_t n, const char *, va_list);
__extern int asprintf(char **, const char *, ...);
__extern int vasprintf(char **, const char *, va_list);
-/* XXX: stream errors should be kept track of */
-__static_inline int ferror(FILE * __f)
-{
- (void)__f;
- return 0;
-}
+__extern int ferror(FILE * );
__extern int feof(FILE *);
__extern int fflush(FILE *);
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index f67ba1c16c43e..753ab85162356 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -60,7 +60,7 @@ klib-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \
setmntent.o endmntent.o getmntent.o \
stdio/fclose.o stdio/fopen.o stdio/fdopen.o stdio/fxopen.o \
stdio/fread.o stdio/fwrite.o stdio/fflush.o \
- stdio/fseek.o stdio/ungetc.o stdio/feof.o
+ stdio/fseek.o stdio/ungetc.o stdio/feof.o stdio/ferror.o
klib-$(CONFIG_KLIBC_ERRLIST) += errlist.o
diff --git a/usr/klibc/stdio/ferror.c b/usr/klibc/stdio/ferror.c
new file mode 100644
index 0000000000000..ab5322f8a825b
--- /dev/null
+++ b/usr/klibc/stdio/ferror.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int ferror(FILE *f)
+{
+ return f->flags & _IO_FILE_FLAG_ERR;
+}