From 9dcb1abe9d159df6db2aa8069b6783c2411b2af5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= <gael@xfce.org>
Date: Sat, 20 May 2023 17:38:56 +0200
Subject: [PATCH] Fix deadcode.DeadStores warnings from scan-build 15.0.7

---
 src/gs-auth-pam.c   | 11 ++---------
 src/gs-window-x11.c |  3 ---
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/gs-auth-pam.c b/src/gs-auth-pam.c
index c45f3e42..ddb81f5d 100644
--- a/src/gs-auth-pam.c
+++ b/src/gs-auth-pam.c
@@ -260,7 +260,6 @@ pam_conversation (int                        nmsgs,
         return PAM_CONV_ERR;
     }
 
-    res = TRUE;
     ret = PAM_SUCCESS;
 
     for (replies = 0; replies < nmsgs && ret == PAM_SUCCESS; replies++) {
@@ -560,7 +559,6 @@ gs_auth_pam_verify_user (pam_handle_t *handle,
                          int          *status) {
     GThread    *auth_thread;
     GIOChannel *channel = NULL;
-    guint       watch_id = 0;
     int         auth_operation_fds[2];
     int         auth_status = PAM_AUTH_ERR;
     gboolean    thread_done;
@@ -592,8 +590,8 @@ gs_auth_pam_verify_user (pam_handle_t *handle,
      * of pam authentication.
      */
     thread_done = FALSE;
-    watch_id = g_io_add_watch (channel, G_IO_ERR | G_IO_HUP,
-                               (GIOFunc) gs_auth_loop_quit, &thread_done);
+    g_io_add_watch (channel, G_IO_ERR | G_IO_HUP,
+                    (GIOFunc) gs_auth_loop_quit, &thread_done);
 
     auth_thread = g_thread_new ("auththread",
                                 gs_auth_thread_func,
@@ -621,11 +619,6 @@ gs_auth_pam_verify_user (pam_handle_t *handle,
     auth_status = GPOINTER_TO_INT (g_thread_join (auth_thread));
 
 out:
-    if (watch_id != 0) {
-        // g_source_remove (watch_id);
-        watch_id = 0;
-    }
-
     if (channel != NULL) {
         g_io_channel_unref (channel);
     }
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 70639401..19c64afd 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -760,7 +760,6 @@ error_watch (GIOChannel   *source,
                 finished = TRUE;
                 break;
             case G_IO_STATUS_ERROR:
-                finished = TRUE;
                 gs_debug ("Error reading from child: %s\n", error->message);
                 g_error_free (error);
                 return FALSE;
@@ -1103,7 +1102,6 @@ keyboard_process_watch (GIOChannel   *source,
                 finished = TRUE;
                 break;
             case G_IO_STATUS_ERROR:
-                finished = TRUE;
                 gs_debug ("Error reading from child: %s\n", error->message);
                 g_error_free (error);
                 return FALSE;
@@ -1300,7 +1298,6 @@ dialog_process_watch (GIOChannel   *source,
                 finished = TRUE;
                 break;
             case G_IO_STATUS_ERROR:
-                finished = TRUE;
                 gs_debug ("Error reading from child: %s\n", error->message);
                 g_error_free (error);
                 return FALSE;
-- 
GitLab