Blame SOURCES/0001-session-worker-don-t-kill-progress-group-until-PostS.patch

ca70cf
From a9d3724eb048862af7f89f037f37582df118abfd Mon Sep 17 00:00:00 2001
ca70cf
From: Ray Strode <rstrode@redhat.com>
ca70cf
Date: Thu, 29 Aug 2019 09:34:04 -0400
ca70cf
Subject: [PATCH] session-worker: don't kill progress group until PostSession
ca70cf
 is run
ca70cf
ca70cf
Killing the process group leads to the worker getting killed, so
ca70cf
the PostSession never gets run.
ca70cf
ca70cf
This commit fixes that, by deferring killing the process group
ca70cf
until after PostSession has run.
ca70cf
---
ca70cf
 daemon/gdm-session-worker.c | 4 ++--
ca70cf
 1 file changed, 2 insertions(+), 2 deletions(-)
ca70cf
ca70cf
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
ca70cf
index 0e8541589..9bdee361f 100644
ca70cf
--- a/daemon/gdm-session-worker.c
ca70cf
+++ b/daemon/gdm-session-worker.c
ca70cf
@@ -1793,65 +1793,65 @@ run_script (GdmSessionWorker *worker,
ca70cf
         }
ca70cf
 
ca70cf
         return gdm_run_script (dir,
ca70cf
                                worker->priv->username,
ca70cf
                                worker->priv->x11_display_name,
ca70cf
                                worker->priv->display_is_local? NULL : worker->priv->hostname,
ca70cf
                                worker->priv->x11_authority_file);
ca70cf
 }
ca70cf
 
ca70cf
 static void
ca70cf
 session_worker_child_watch (GPid              pid,
ca70cf
                             int               status,
ca70cf
                             GdmSessionWorker *worker)
ca70cf
 {
ca70cf
         g_debug ("GdmSessionWorker: child (pid:%d) done (%s:%d)",
ca70cf
                  (int) pid,
ca70cf
                  WIFEXITED (status) ? "status"
ca70cf
                  : WIFSIGNALED (status) ? "signal"
ca70cf
                  : "unknown",
ca70cf
                  WIFEXITED (status) ? WEXITSTATUS (status)
ca70cf
                  : WIFSIGNALED (status) ? WTERMSIG (status)
ca70cf
                  : -1);
ca70cf
 
ca70cf
 
ca70cf
         gdm_session_worker_uninitialize_pam (worker, PAM_SUCCESS);
ca70cf
 
ca70cf
         gdm_dbus_worker_emit_session_exited (GDM_DBUS_WORKER (worker),
ca70cf
                                              worker->priv->service,
ca70cf
                                              status);
ca70cf
 
ca70cf
-        killpg (pid, SIGHUP);
ca70cf
-
ca70cf
         worker->priv->child_pid = -1;
ca70cf
         worker->priv->child_watch_id = 0;
ca70cf
         run_script (worker, GDMCONFDIR "/PostSession");
ca70cf
+
ca70cf
+        killpg (pid, SIGHUP);
ca70cf
 }
ca70cf
 
ca70cf
 static void
ca70cf
 gdm_session_worker_watch_child (GdmSessionWorker *worker)
ca70cf
 {
ca70cf
         g_debug ("GdmSession worker: watching pid %d", worker->priv->child_pid);
ca70cf
         worker->priv->child_watch_id = g_child_watch_add (worker->priv->child_pid,
ca70cf
                                                           (GChildWatchFunc)session_worker_child_watch,
ca70cf
                                                           worker);
ca70cf
 
ca70cf
 }
ca70cf
 
ca70cf
 static gboolean
ca70cf
 _is_loggable_file (const char* filename)
ca70cf
 {
ca70cf
         struct stat file_info;
ca70cf
 
ca70cf
         if (g_lstat (filename, &file_info) < 0) {
ca70cf
                 return FALSE;
ca70cf
         }
ca70cf
 
ca70cf
         return S_ISREG (file_info.st_mode) && g_access (filename, R_OK | W_OK) == 0;
ca70cf
 }
ca70cf
 
ca70cf
 static void
ca70cf
 rotate_logs (const char *path,
ca70cf
              guint       n_copies)
ca70cf
 {
ca70cf
         int i;
ca70cf
 
ca70cf
-- 
ca70cf
2.21.0
ca70cf