File slurmsmwd-uses-xdaemon_-for-systemd.patch of Package slurm.13628

From b01f2ce29ce362b0724ea8104aadbab45122e9a4 Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Mon, 4 Jun 2018 14:44:31 +0200
Subject: [PATCH 5/6] slurmsmwd uses xdaemon_* for systemd

---
 contribs/cray/slurmsmwd/main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/contribs/cray/slurmsmwd/main.c b/contribs/cray/slurmsmwd/main.c
index 8d405b2916..c1d3fce2d4 100644
--- a/contribs/cray/slurmsmwd/main.c
+++ b/contribs/cray/slurmsmwd/main.c
@@ -536,6 +536,7 @@ int main(int argc, char **argv)
 {
 	pthread_t processing_thread, signal_handler_thread;
 	pthread_attr_t thread_attr;
+	int pipefd;
 
 	_parse_commandline(argc, argv);
 
@@ -544,11 +545,15 @@ int main(int argc, char **argv)
 	slurmsmwd_print_config();
 
 	if (!foreground) {
-		if (xdaemon())
+		pipefd = xdaemon_init();
+		if (pipefd == -1)
 			error("daemon(): %m");
 	}
 	if (create_pidfile("/var/run/slurmsmwd.pid", 0) < 0)
 		fatal("Unable to create pidfile /var/run/slurmswmd.pid");
+	if (!foreground) {
+		xdaemon_finish(pipefd);
+	}
 
 	slurm_mutex_init(&down_node_lock);
 
-- 
2.13.7