X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fgets.c;h=798df766c08590d1d3953667714f3331a105becb;hb=cd6cfe0f578c4f744ddc9a342243aff6b42f8027;hp=83a261efd6744001414b25dcf2f234afb32bccb9;hpb=0e35e82c5e9a0804864839e8fc0e985b1ae41f07;p=pdclib.old diff --git a/functions/stdio/gets.c b/functions/stdio/gets.c index 83a261e..798df76 100644 --- a/functions/stdio/gets.c +++ b/functions/stdio/gets.c @@ -14,13 +14,16 @@ char * gets( char * s ) { + _PDCLIB_flockfile( stdin ); if ( _PDCLIB_prepread( stdin ) == EOF ) { + _PDCLIB_funlockfile( stdin ); return NULL; } char * dest = s; dest += _PDCLIB_getchars( dest, SIZE_MAX, '\n', stdin ); + _PDCLIB_funlockfile( stdin ); if(*(dest - 1) == '\n') { *(--dest) = '\0';