From fb81a0b4e21086dc87f8ce1999266a0e7a5b0763 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 5 Apr 2016 23:07:11 +0200 Subject: examples:smbclient:write: fix O3 error unused result of fgets Signed-off-by: Michael Adam Reviewed-by: Christian Ambach --- examples/libsmbclient/testwrite.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'examples') 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; -- cgit v1.2.1