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

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