]> pd.if.org Git - pdclib/blobdiff - functions/stdio/rewind.c
rewind: Add _unlocked variation. Make rewind() actually take lock before touching...
[pdclib] / functions / stdio / rewind.c
index 4dab8e9e2cbe9943392011876bf9723a060005b9..0a19155b5820428acd62c40996d8aa8b8ceaf35c 100644 (file)
 
 #ifndef REGTEST
 
-void rewind( struct _PDCLIB_file_t * stream )
+void rewind_unlocked( struct _PDCLIB_file_t * stream )
 {
     stream->status &= ~ _PDCLIB_ERRORFLAG;
-    fseek( stream, 0L, SEEK_SET );
+    fseek_unlocked( stream, 0L, SEEK_SET );
+}
+
+void rewind( struct _PDCLIB_file_t * stream )
+{
+    flockfile(stream);
+    rewind_unlocked(stream);
+    funlockfile(stream);
 }
 
 #endif