diff --git a/reactos/sdk/lib/crt/stdio/file.c b/reactos/sdk/lib/crt/stdio/file.c index b13176b..8f92d76 100644 --- a/reactos/sdk/lib/crt/stdio/file.c +++ b/reactos/sdk/lib/crt/stdio/file.c @@ -3569,6 +3569,12 @@ char * CDECL gets(char *buf) *buf = '\0'; TRACE("got '%s'\n", buf_start); + if ((cc == EOF) && (buf == buf_start)) /* If nothing read, return 0*/ + { + _unlock_file(stdin); + return NULL; + } + _unlock_file(stdin); return buf_start; } @@ -3590,6 +3596,13 @@ wchar_t* CDECL _getws(wchar_t* buf) } *buf = '\0'; + if ((cc == WEOF) && (buf == ws)) /* If nothing read, return 0*/ + { + TRACE(":nothing read\n"); + _unlock_file(stdin); + return NULL; + } + TRACE("got %s\n", debugstr_w(ws)); _unlock_file(stdin); return ws;