fgets() returns NULL on error, not < 0

This commit is contained in:
Sven-Haegar Koch 2011-05-28 03:48:07 +02:00 committed by Guus Sliepen
parent 434e57ae5e
commit e6b21e1a51

View file

@ -159,7 +159,7 @@ FILE *ask_and_open(const char *filename, const char *what, const char *mode) {
what, filename);
fflush(stdout);
if(fgets(buf, sizeof buf, stdin) < 0) {
if(fgets(buf, sizeof buf, stdin) == NULL) {
fprintf(stderr, "Error while reading stdin: %s\n",
strerror(errno));
return NULL;