]> 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 7ca531ed441bb00eec8b35e59370b6928f7aa798..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