X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffputc.c;fp=functions%2Fstdio%2Ffputc.c;h=ae998eaacb0562c01070589c56f4400ae9451c8c;hb=6ca24b75c75b9c6f22e1e69693d326b8e3330841;hp=818d45f645057fe4c93954964eb6b9d4c526e098;hpb=6cb7e8dab67e8807aad79c3bdc8f96d78a5e5dbc;p=pdclib diff --git a/functions/stdio/fputc.c b/functions/stdio/fputc.c index 818d45f..ae998ea 100644 --- a/functions/stdio/fputc.c +++ b/functions/stdio/fputc.c @@ -16,7 +16,7 @@ Returns c if successful, EOF otherwise. If a write error occurs, the error indicator of the stream is set. */ -int fputc( int c, struct _PDCLIB_file_t * stream ) +int fputc_unlocked( int c, struct _PDCLIB_file_t * stream ) { if ( _PDCLIB_prepwrite( stream ) == EOF ) { @@ -34,6 +34,14 @@ int fputc( int c, struct _PDCLIB_file_t * stream ) return c; } +int fputc( int c, struct _PDCLIB_file_t * stream ) +{ + flockfile( stream ); + int r = fputc_unlocked( c, stream ); + funlockfile( stream ); + return r; +} + #endif #ifdef TEST