]> pd.if.org Git - pdclib/commitdiff
rewind: Add _unlocked variation. Make rewind() actually take lock before touching...
authorOwen Shepherd <owen.shepherd@e43.eu>
Thu, 27 Dec 2012 21:37:26 +0000 (21:37 +0000)
committerOwen Shepherd <owen.shepherd@e43.eu>
Thu, 27 Dec 2012 21:37:26 +0000 (21:37 +0000)
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