File slurmd-uses-xdaemon_-for-systemd.patch of Package slurm.8888

From 712caf6306c5b08b12e5a481d60bb91adc6c625e Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Mon, 9 Apr 2018 10:59:57 +0200
Subject: [PATCH 3/6] slurmd uses xdaemon_* for systemd

---
 src/slurmd/slurmd/slurmd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 140fd70adc..92d1faf0bc 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -214,7 +214,7 @@ static void      _wait_for_all_threads(int secs);
 int
 main (int argc, char **argv)
 {
-	int i, pidfd;
+	int i, pidfd, pipefd;
 	int blocked_signals[] = {SIGPIPE, 0};
 	int cc;
 	char *oom_value;
@@ -299,7 +299,8 @@ main (int argc, char **argv)
 	 * Become a daemon if desired.
 	 */
 	if (conf->daemonize) {
-		if (xdaemon())
+		pipefd = xdaemon_init();
+		if (pipefd == -1)
 			error("Couldn't daemonize slurmd: %m");
 	}
 	test_core_limit();
@@ -355,6 +356,9 @@ main (int argc, char **argv)
 
 	conf->pid = getpid();
 	pidfd = create_pidfile(conf->pidfile, 0);
+	if (conf->daemonize) {
+		xdaemon_finish(pipefd);
+	}
 
 	rfc2822_timestamp(time_stamp, sizeof(time_stamp));
 	info("%s started on %s", slurm_prog_name, time_stamp);
-- 
2.13.7

openSUSE Build Service is sponsored by