fgets() returns NULL on error, not < 0
This commit is contained in:
parent
434e57ae5e
commit
e6b21e1a51
1 changed files with 1 additions and 1 deletions
|
@ -159,7 +159,7 @@ FILE *ask_and_open(const char *filename, const char *what, const char *mode) {
|
||||||
what, filename);
|
what, filename);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if(fgets(buf, sizeof buf, stdin) < 0) {
|
if(fgets(buf, sizeof buf, stdin) == NULL) {
|
||||||
fprintf(stderr, "Error while reading stdin: %s\n",
|
fprintf(stderr, "Error while reading stdin: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue