Add --disable-redirect-output to configure script

This patch makes it possible to control the default redirection of
(misbehaving) services output to /dev/null.  With this disabled,
a service may write to its stdout/stderr and mess up the console.

By default all service/run/tasks stdout/stderr is redirected.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-12-28 20:22:06 +01:00
parent 8198582c10
commit e1bb5e3396
2 changed files with 11 additions and 1 deletions
+7
View File
@@ -58,6 +58,10 @@ AC_ARG_ENABLE(watchdog,
AS_HELP_STRING([--enable-watchdog], [Enable built-in watchdog, uses /dev/watchdog]),,[
enable_watchdog=no])
AC_ARG_ENABLE(redirect-output,
AS_HELP_STRING([--disable-redirect-output], [Disable redirection of service output to /dev/null]),,[
enable_redirect_output=yes])
AC_ARG_ENABLE(inetd,
AS_HELP_STRING([--disable-inetd], [Disable built-in inetd super server, default enabled]),,[
enable_inetd=yes])
@@ -148,6 +152,9 @@ AS_IF([test "x$enable_inetd" != "xno"], [
enable_inetd="yes"
AC_DEFINE(INETD_ENABLED, 1, [Enable built-in inetd])])
AS_IF([test "x$enable_redirect_output" != "xno"], [
AC_DEFINE(REDIRECT_OUTPUT, 1, [Enable redirection of service output to /dev/null])])
AS_IF([test "x$enable_logrotate" != "xno"], [
AC_DEFINE(LOGROTATE_ENABLED, 1, [Enable built-in rotation of /var/log/wtmp et al.])])
+4 -1
View File
@@ -258,7 +258,9 @@ static int service_start(svc_t *svc)
dup2(fd, STDERR_FILENO);
close(fd);
}
} else {
}
#ifdef REDIRECT_OUTPUT
else {
FILE *fp;
fp = fopen("/dev/null", "w");
@@ -268,6 +270,7 @@ static int service_start(svc_t *svc)
fclose(fp);
}
}
#endif
logger_err:
sig_unblock();