diff options
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; |