mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-13 18:10:00 -04:00
added -T keepstderr to keep stderr open when daemonizing [RT #43736]
(cherry picked from commit c9ee977f31)
This commit is contained in:
parent
150ff959d1
commit
88ec925cfc
3 changed files with 6 additions and 1 deletions
|
|
@ -164,6 +164,7 @@ EXTERN isc_boolean_t ns_g_dropedns INIT(ISC_FALSE);
|
|||
EXTERN isc_boolean_t ns_g_noedns INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_nosoa INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_noaa INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_keepstderr INIT(ISC_FALSE);
|
||||
EXTERN unsigned int ns_g_delay INIT(0);
|
||||
EXTERN isc_boolean_t ns_g_nonearest INIT(ISC_FALSE);
|
||||
EXTERN isc_boolean_t ns_g_notcp INIT(ISC_FALSE);
|
||||
|
|
|
|||
|
|
@ -616,6 +616,9 @@ parse_command_line(int argc, char *argv[]) {
|
|||
else if (!strncmp(isc_commandline_argument, "tat=", 4))
|
||||
ns_g_tat_interval =
|
||||
atoi(isc_commandline_argument + 4);
|
||||
else if (!strcmp(isc_commandline_argument,
|
||||
"keepstderr"))
|
||||
ns_g_keepstderr = ISC_TRUE;
|
||||
else
|
||||
fprintf(stderr, "unknown -T flag '%s\n",
|
||||
isc_commandline_argument);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
#include <isc/strerror.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
#include <named/globals.h>
|
||||
#include <named/main.h>
|
||||
#include <named/os.h>
|
||||
#ifdef HAVE_LIBSCF
|
||||
|
|
@ -460,7 +461,7 @@ ns_os_daemonize(void) {
|
|||
(void)close(STDOUT_FILENO);
|
||||
(void)dup2(devnullfd, STDOUT_FILENO);
|
||||
}
|
||||
if (devnullfd != STDERR_FILENO) {
|
||||
if (devnullfd != STDERR_FILENO && !ns_g_keepstderr) {
|
||||
(void)close(STDERR_FILENO);
|
||||
(void)dup2(devnullfd, STDERR_FILENO);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue