[libdmapsharing] Fix a warning about ignoring fgets' return value



commit e4f575037331e34ccaf2b2db30ce459b784768f0
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 711802c..d2c87dd 100644
--- a/tests/test-dmap-client.c
+++ b/tests/test-dmap-client.c
@@ -96,10 +96,15 @@ authenticate_cb (DmapConnection *connection,
                 G_GNUC_UNUSED gboolean retrying,
                 G_GNUC_UNUSED 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.
 
        dmap_connection_authenticate_message(connection, session, msg, auth, password);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]