mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
service_start(): Redirect service output to /dev/null by default
This patch prevents output of stderr/stdout from services to leak to the console. Use the 'log' keyword to service/run/task stanza to redirect output to syslog. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b02f241e5e
commit
2b173e831f
1 file changed
+10
@@ -265,7 +265,17 @@ static int service_start(svc_t *svc)
|
||||
dup2(fd, STDERR_FILENO);
|
||||
close(fd);
|
||||
}
|
||||
} else {
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen("/dev/null", "w");
|
||||
if (fp) {
|
||||
dup2(fileno(fp), STDOUT_FILENO);
|
||||
dup2(fileno(fp), STDERR_FILENO);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
logger_err:
|
||||
sig_unblock();
|
||||
|
||||
|
||||
Reference in new issue
Block a user