]> pd.if.org Git - pdclib/blobdiff - functions/stdio/ferror.c
PDCLIB-16: Add _unlocked variations of all I/O routines; move work into these versions
[pdclib] / functions / stdio / ferror.c
index 6f24080697ba63e435fe41c1b6583857ef64603e..394dcda2bc7dd07dee9cad93b61dfd95ec50ddd1 100644 (file)
 
 #ifndef REGTEST
 
-int ferror( struct _PDCLIB_file_t * stream )
+int ferror_unlocked( struct _PDCLIB_file_t * stream )
 {
     return stream->status & _PDCLIB_ERRORFLAG;
 }
 
+int ferror( struct _PDCLIB_file_t * stream )
+{
+    flockfile( stream );
+    int error = ferror_unlocked( stream );
+    funlockfile( stream );
+    return error;
+}
+
 #endif
 
 #ifdef TEST
@@ -27,3 +35,4 @@ int main( void )
 }
 
 #endif
+