From 9a77499d5947c498be4f3981b87eff510602d0f9 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Thu, 27 Dec 2012 21:37:26 +0000 Subject: [PATCH] rewind: Add _unlocked variation. Make rewind() actually take lock before touching file object --- functions/stdio/rewind.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/functions/stdio/rewind.c b/functions/stdio/rewind.c index 4dab8e9..0a19155 100644 --- a/functions/stdio/rewind.c +++ b/functions/stdio/rewind.c @@ -10,10 +10,17 @@ #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 -- 2.40.0