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