X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fferror.c;h=0067bed48288d6be1598af124299af8b0bc5d3ba;hb=e1c526e9bad3f6e69391e94059096145390508d3;hp=b6f51ee6092ffe077edb769cca3dc0cb8f418492;hpb=13ee02fa27a739d9d602f801126eadcfbfeab8a8;p=pdclib diff --git a/functions/stdio/ferror.c b/functions/stdio/ferror.c index b6f51ee..0067bed 100644 --- a/functions/stdio/ferror.c +++ b/functions/stdio/ferror.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* ferror( FILE * ) This file is part of the Public Domain C Library (PDCLib). @@ -9,12 +7,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 +29,9 @@ int ferror( struct _PDCLIB_file_t * stream ) int main( void ) { - TESTCASE( NO_TESTDRIVER ); + /* Testing covered by clearerr(). */ return TEST_RESULTS; } #endif +