]> pd.if.org Git - pdclib.old/blobdiff - functions/stdio/ferror.c
[gandr] s/__lp64__/__LP64__/ to match GCC define
[pdclib.old] / functions / stdio / ferror.c
index 6f24080697ba63e435fe41c1b6583857ef64603e..07ecde7228774b237f6a5fbdbaa2ec8c93e973cc 100644 (file)
@@ -9,12 +9,21 @@
 #include <stdio.h>
 
 #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
@@ -27,3 +36,4 @@ int main( void )
 }
 
 #endif
+