diff options
author | Volker Lendecke <vl@samba.org> | 2015-06-30 20:41:55 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2015-10-28 16:00:21 +0100 |
commit | 7e45bec38fe31be3fdad1d42bfdd7136c1663ba5 (patch) | |
tree | a01e1a27cb08f3ca8c2611c9c976a06600831ab9 /examples/libsmbclient | |
parent | af03f5b4e838003b1d9f2e77239f28e1e363d463 (diff) | |
download | samba-7e45bec38fe31be3fdad1d42bfdd7136c1663ba5.tar.gz |
examples: Fix unchecked result warnings
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'examples/libsmbclient')
-rw-r--r-- | examples/libsmbclient/get_auth_data_fn.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h index 6b91c973375..5f2be72a633 100644 --- a/examples/libsmbclient/get_auth_data_fn.h +++ b/examples/libsmbclient/get_auth_data_fn.h @@ -16,6 +16,7 @@ get_auth_data_fn(const char * pServer, char workgroup[256] = { '\0' }; char username[256] = { '\0' }; char password[256] = { '\0' }; + char *ret; static int krb5_set = 1; @@ -36,7 +37,10 @@ get_auth_data_fn(const char * pServer, } fprintf(stdout, "Workgroup: [%s] ", pWorkgroup); - fgets(temp, sizeof(temp), stdin); + ret = fgets(temp, sizeof(temp), stdin); + if (ret == NULL) { + return; + } if (temp[strlen(temp) - 1] == '\n') /* A new line? */ { @@ -49,7 +53,10 @@ get_auth_data_fn(const char * pServer, } fprintf(stdout, "Username: [%s] ", pUsername); - fgets(temp, sizeof(temp), stdin); + ret = fgets(temp, sizeof(temp), stdin); + if (ret == NULL) { + return; + } if (temp[strlen(temp) - 1] == '\n') /* A new line? */ { @@ -62,7 +69,10 @@ get_auth_data_fn(const char * pServer, } fprintf(stdout, "Password: "); - fgets(temp, sizeof(temp), stdin); + ret = fgets(temp, sizeof(temp), stdin); + if (ret == NULL) { + return; + } if (temp[strlen(temp) - 1] == '\n') /* A new line? */ { |