diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2022-01-18 00:50:47 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2022-01-18 00:50:47 +0000 |
commit | 9dea8f12c7617bcee02319adbb51353b6b35b2f8 (patch) | |
tree | 20068e47fa0fce562cdb8de75574434dcb791e94 /src | |
parent | 5732024c9991f1e220ad203087997ca467a5cef7 (diff) |
Debug: pass ACL-initiated debug through execs
Diffstat (limited to 'src')
-rw-r--r-- | src/src/child.c | 10 | ||||
-rw-r--r-- | src/src/log.c | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/src/child.c b/src/src/child.c index 54583c3ae..4a262d623 100644 --- a/src/src/child.c +++ b/src/src/child.c @@ -108,7 +108,17 @@ if (!minimal) else { if (debug_selector != 0) + { argv[n++] = string_sprintf("-d=0x%x", debug_selector); + if (debug_fd > 2) + { + int flags = fcntl(debug_fd, F_GETFD); + if (flags != -1) (void)fcntl(debug_fd, F_SETFD, flags & ~FD_CLOEXEC); + close(2); + dup2(debug_fd, 2); + close(debug_fd); + } + } } DEBUG(D_any) { diff --git a/src/src/log.c b/src/src/log.c index b085e9ee2..2c82ee0a4 100644 --- a/src/src/log.c +++ b/src/src/log.c @@ -1475,8 +1475,6 @@ for certain sources. The second use is inetd wait mode debug preservation. */ void debug_logging_activate(uschar *tag_name, uschar *opts) { -int fd = -1; - if (debug_file) { debug_printf("DEBUGGING ACTIVATED FROM WITHIN CONFIG.\n" @@ -1502,10 +1500,10 @@ do not segfault; note that nondefault log locations will not work */ if (!*file_path) set_file_path(NULL); -open_log(&fd, lt_debug, tag_name); +open_log(&debug_fd, lt_debug, tag_name); -if (fd != -1) - debug_file = fdopen(fd, "w"); +if (debug_fd != -1) + debug_file = fdopen(debug_fd, "w"); else log_write(0, LOG_MAIN|LOG_PANIC, "unable to open debug log"); } |