From: Sven-Haegar Koch Date: Sat, 28 May 2011 01:48:07 +0000 (+0200) Subject: fgets() returns NULL on error, not < 0 X-Git-Tag: release-1.1pre1~37 X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=e6b21e1a510691a86dcc1ecdf71a80a7c62ff17f fgets() returns NULL on error, not < 0 --- diff --git a/src/tincctl.c b/src/tincctl.c index 5477fd0e..ef5233c5 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -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;