Blame SOURCES/0062-MONITOR-Don-t-check-for-pidfile-if-SSSD-is-already-r.patch

71e593
From 4b52ed0610e399a0fe27cfab3601419acb6aff3d Mon Sep 17 00:00:00 2001
71e593
From: Jakub Hrozek <jhrozek@redhat.com>
71e593
Date: Fri, 5 Oct 2018 13:50:37 +0200
71e593
Subject: [PATCH 62/66] MONITOR: Don't check for pidfile if SSSD is already
71e593
 running
71e593
MIME-Version: 1.0
71e593
Content-Type: text/plain; charset=UTF-8
71e593
Content-Transfer-Encoding: 8bit
71e593
71e593
Related:
71e593
https://pagure.io/SSSD/sssd/issue/3862
71e593
71e593
The --genconf option of sssd is meant to be used to reload configuration from a
71e593
systemd socket-activated service. But it would only work if sssd was not
71e593
running, which defies its purpose.
71e593
71e593
Reviewed-by: Michal Židek <mzidek@redhat.com>
71e593
---
71e593
 src/monitor/monitor.c | 18 +++++++++++-------
71e593
 1 file changed, 11 insertions(+), 7 deletions(-)
71e593
71e593
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
71e593
index 335b2070b..ea689c604 100644
71e593
--- a/src/monitor/monitor.c
71e593
+++ b/src/monitor/monitor.c
71e593
@@ -2514,13 +2514,17 @@ int main(int argc, const char *argv[])
71e593
         }
71e593
     }
71e593
 
71e593
-    /* Check if the SSSD is already running */
71e593
-    ret = check_file(SSSD_PIDFILE, 0, 0, S_IFREG|0600, 0, NULL, false);
71e593
-    if (ret == EOK) {
71e593
-        DEBUG(SSSDBG_FATAL_FAILURE,
71e593
-              "pidfile exists at %s\n", SSSD_PIDFILE);
71e593
-        ERROR("SSSD is already running\n");
71e593
-        return 2;
71e593
+    /* Check if the SSSD is already running unless we're only interested
71e593
+     * in re-reading the configuration
71e593
+     */
71e593
+    if (opt_genconf == 0) {
71e593
+        ret = check_file(SSSD_PIDFILE, 0, 0, S_IFREG|0600, 0, NULL, false);
71e593
+        if (ret == EOK) {
71e593
+            DEBUG(SSSDBG_FATAL_FAILURE,
71e593
+                "pidfile exists at %s\n", SSSD_PIDFILE);
71e593
+            ERROR("SSSD is already running\n");
71e593
+            return 2;
71e593
+        }
71e593
     }
71e593
 
71e593
     /* Parse config file, fail if cannot be done */
71e593
-- 
71e593
2.19.1
71e593