X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2Ffseek.c;h=c897325509b4421e7277d8eb4f77b1dc9f5738b8;hp=8e10c2ba007f49cd599c7c5fc62275995076e729;hb=6ca24b75c75b9c6f22e1e69693d326b8e3330841;hpb=6cb7e8dab67e8807aad79c3bdc8f96d78a5e5dbc diff --git a/functions/stdio/fseek.c b/functions/stdio/fseek.c index 8e10c2b..c897325 100644 --- a/functions/stdio/fseek.c +++ b/functions/stdio/fseek.c @@ -12,7 +12,7 @@ #include <_PDCLIB_glue.h> -int fseek( struct _PDCLIB_file_t * stream, long loffset, int whence ) +int fseek_unlocked( struct _PDCLIB_file_t * stream, long loffset, int whence ) { _PDCLIB_int64_t offset = loffset; if ( stream->status & _PDCLIB_FWRITE ) @@ -37,6 +37,14 @@ int fseek( struct _PDCLIB_file_t * stream, long loffset, int whence ) return ( _PDCLIB_seek( stream, offset, whence ) != EOF ) ? 0 : EOF; } +int fseek( struct _PDCLIB_file_t * stream, long loffset, int whence ) +{ + flockfile( stream ); + int r = fseek_unlocked( stream, loffset, whence ); + funlockfile( stream ); + return r; +} + #endif #ifdef TEST