X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fferror.c;h=07ecde7228774b237f6a5fbdbaa2ec8c93e973cc;hb=HEAD;hp=b6f51ee6092ffe077edb769cca3dc0cb8f418492;hpb=a6dd99e5c0b3af81082d24751218c21f7f3e7443;p=pdclib.old diff --git a/functions/stdio/ferror.c b/functions/stdio/ferror.c index b6f51ee..07ecde7 100644 --- a/functions/stdio/ferror.c +++ b/functions/stdio/ferror.c @@ -9,12 +9,21 @@ #include #ifndef REGTEST +#include <_PDCLIB_io.h> -int ferror( struct _PDCLIB_file_t * stream ) +int _PDCLIB_ferror_unlocked( FILE * stream ) { return stream->status & _PDCLIB_ERRORFLAG; } +int ferror( FILE * stream ) +{ + _PDCLIB_flockfile( stream ); + int error = _PDCLIB_ferror_unlocked( stream ); + _PDCLIB_funlockfile( stream ); + return error; +} + #endif #ifdef TEST @@ -22,8 +31,9 @@ int ferror( struct _PDCLIB_file_t * stream ) int main( void ) { - TESTCASE( NO_TESTDRIVER ); + /* Testing covered by clearerr(). */ return TEST_RESULTS; } #endif +