X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffseek.c;h=35b641610da02e0e8a686c655e8fe3c516033b72;hb=3fc6b339325dcf3f49c90a0fa76a45e438aff79c;hp=8e10c2ba007f49cd599c7c5fc62275995076e729;hpb=05556502a427911d4499c22b809ca7d366327d7c;p=pdclib diff --git a/functions/stdio/fseek.c b/functions/stdio/fseek.c index 8e10c2b..35b6416 100644 --- a/functions/stdio/fseek.c +++ b/functions/stdio/fseek.c @@ -9,10 +9,9 @@ #include #ifndef REGTEST +#include <_PDCLIB_io.h> -#include <_PDCLIB_glue.h> - -int fseek( struct _PDCLIB_file_t * stream, long loffset, int whence ) +int fseek_unlocked( FILE * stream, long loffset, int whence ) { _PDCLIB_int64_t offset = loffset; if ( stream->status & _PDCLIB_FWRITE ) @@ -37,6 +36,14 @@ int fseek( struct _PDCLIB_file_t * stream, long loffset, int whence ) return ( _PDCLIB_seek( stream, offset, whence ) != EOF ) ? 0 : EOF; } +int fseek( FILE * stream, long loffset, int whence ) +{ + flockfile( stream ); + int r = fseek_unlocked( stream, loffset, whence ); + funlockfile( stream ); + return r; +} + #endif #ifdef TEST