diff options
author | Michael Adam <obnox@samba.org> | 2016-04-05 23:07:11 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2016-05-13 00:16:17 +0200 |
commit | fb81a0b4e21086dc87f8ce1999266a0e7a5b0763 (patch) | |
tree | dc460c4fef467968fed4f79059454aee7df0e526 /examples | |
parent | b279aa1f7cab0dcdf8466f0bea13faa0cbabacba (diff) | |
download | samba-fb81a0b4e21086dc87f8ce1999266a0e7a5b0763.tar.gz |
examples:smbclient:write: fix O3 error unused result of fgets
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/libsmbclient/testwrite.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; |