From: Egbert Eich Date: Tue Nov 20 09:52:22 2018 +0100 Subject: slurmd uses xdaemon_* for systemd Patch-mainline: Not yet Git-commit: 3988e62eb8c20a29a7a016f264c6d65e114cfdf4 References: bsc#1084125 Signed-off-by: Egbert Eich --- slurm-18.08.3/src/slurmd/slurmd/slurmd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slurm-18.08.3/src/slurmd/slurmd/slurmd.c b/slurm-18.08.3/src/slurmd/slurmd/slurmd.c index aa35f8a..b2feaf9 100644 --- a/src/slurmd/slurmd/slurmd.c +++ b/src/slurmd/slurmd/slurmd.c @@ -215,7 +215,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; @@ -300,7 +300,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(); @@ -356,6 +357,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);