Merge pull request #153 from troglobit/logit-post-signal

Logit post SIGTERM, SIGINT etc.
This commit is contained in:
Joachim Wiberg
2021-02-17 10:56:20 +01:00
committed by GitHub
+6 -6
View File
@@ -191,9 +191,6 @@ static int lredirect(svc_t *svc)
return -1;
}
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
pid = fork();
if (pid == 0) {
int fds;
@@ -240,6 +237,9 @@ static int lredirect(svc_t *svc)
_exit(0);
}
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
return close(fd);
}
@@ -371,6 +371,9 @@ static int service_start(svc_t *svc)
}
args[i] = NULL;
redirect(svc);
sig_unblock();
/*
* The setsid() call is the most humble of all in this
* function. It takes care to detach the process from
@@ -385,9 +388,6 @@ static int service_start(svc_t *svc)
*/
setsid();
redirect(svc);
sig_unblock();
if (svc_is_runtask(svc))
status = exec_runtask(svc->cmd, args);
else