X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_ftell64.c;h=e0ea368e757e35b81bcdf0d606f7a283520b8971;hp=650eda548d48051863868df176fffdb1584ecf51;hb=6ca24b75c75b9c6f22e1e69693d326b8e3330841;hpb=6cb7e8dab67e8807aad79c3bdc8f96d78a5e5dbc diff --git a/functions/stdio/_PDCLIB_ftell64.c b/functions/stdio/_PDCLIB_ftell64.c index 650eda5..e0ea368 100644 --- a/functions/stdio/_PDCLIB_ftell64.c +++ b/functions/stdio/_PDCLIB_ftell64.c @@ -12,7 +12,7 @@ #ifndef REGTEST -uint_fast64_t _PDCLIB_ftell64( struct _PDCLIB_file_t * stream ) +uint_fast64_t _PDCLIB_ftell64_unlocked( struct _PDCLIB_file_t * stream ) { /* ftell() must take into account: - the actual *physical* offset of the file, i.e. the offset as recognized @@ -38,6 +38,14 @@ uint_fast64_t _PDCLIB_ftell64( struct _PDCLIB_file_t * stream ) return ( stream->pos.offset - ( ( (int)stream->bufend - (int)stream->bufidx ) + (int)stream->ungetidx ) ); } +uint_fast64_t _PDCLIB_ftell64( struct _PDCLIB_file_t * stream ) +{ + flockfile( stream ); + uint_fast64_t pos = _PDCLIB_ftell64_unlocked( stream ); + funlockfile( stream ); + return pos; +} + #endif #ifdef TEST