[libdmapsharing/LIBDMAPSHARING_3_0] Fix a warning about ignoring fgets' return value
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing/LIBDMAPSHARING_3_0] Fix a warning about ignoring fgets' return value
- Date: Wed, 1 Jul 2020 00:44:29 +0000 (UTC)
commit 379b09cba9723d6ec6314804f7696d3749a6d2da
Author: W. Michael Petullo <mike flyn org>
Date: Tue Jun 30 19:44:11 2020 -0500
Fix a warning about ignoring fgets' return value
tests/test-dmap-client.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/tests/test-dmap-client.c b/tests/test-dmap-client.c
index ea18737..86b406f 100644
--- a/tests/test-dmap-client.c
+++ b/tests/test-dmap-client.c
@@ -74,10 +74,15 @@ authenticate_cb (DMAPConnection *connection,
gboolean retrying,
gpointer user_data)
{
- char *username, password[BUFSIZ + 1];
+ char *username, password[BUFSIZ + 1], *rc;
g_object_get (connection, "username", &username, NULL);
g_print ("Password required (username is %s): ", username);
- fgets (password, BUFSIZ, stdin);
+
+ rc = fgets (password, BUFSIZ, stdin);
+ if (rc != password) {
+ g_error ("failed to read password");
+ }
+
password[strlen(password) - 1] = 0x00; // Remove newline.
g_object_set (connection, "password", password, NULL);
soup_auth_authenticate (auth, username, password);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]