From: Michael Adam Date: Tue, 5 Apr 2016 21:07:11 +0000 (+0200) Subject: examples:smbclient:write: fix O3 error unused result of fgets X-Git-Tag: tdb-1.3.10~1161 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=fb81a0b4e21086dc87f8ce1999266a0e7a5b0763;p=samba.git examples:smbclient:write: fix O3 error unused result of fgets Signed-off-by: Michael Adam Reviewed-by: Christian Ambach --- diff --git a/examples/libsmbclient/testwrite.c b/examples/libsmbclient/testwrite.c index 636cb2046de..1837839d298 100644 --- a/examples/libsmbclient/testwrite.c +++ b/examples/libsmbclient/testwrite.c @@ -22,14 +22,22 @@ int main(int argc, char * argv[]) printf("CAUTION: This program will overwrite a file. " "Press ENTER to continue."); - fgets(buffer, sizeof(buffer), stdin); + p = fgets(buffer, sizeof(buffer), stdin); + if (p == NULL) { + fprintf(stderr, "failed to read from stdin\n"); + return 1; + } for (;;) { fprintf(stdout, "\nPath: "); *path = '\0'; - fgets(path, sizeof(path) - 1, stdin); + p = fgets(path, sizeof(path) - 1, stdin); + if (p == NULL) { + fprintf(stderr, "failed to read from stdin\n"); + return 1; + } if (strlen(path) == 0) { return 0;