X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffputc.c;h=ae998eaacb0562c01070589c56f4400ae9451c8c;hb=84d648157e22cecc65902ecfdd4e3a1b88d5e53f;hp=818d45f645057fe4c93954964eb6b9d4c526e098;hpb=fce9a8538009ea5c113b03c608cedf036ce4a364;p=pdclib.old 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