The Samba-Bugzilla – Attachment 18071 Details for
Bug 15460
Logging to stdout/stderr with DEBUG_SYSLOG_FORMAT_ALWAYS can log to syslog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for v4-19-test
BZ15460.patch (text/plain), 2.75 KB, created by
Martin Schwenke
on 2023-08-28 01:54:53 UTC
(
hide
)
Description:
Patch for v4-19-test
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2023-08-28 01:54:53 UTC
Size:
2.75 KB
patch
obsolete
>From 9d44a8ad0aab375a3f518d696cf3c6fa819cab74 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <mschwenke@ddn.com> >Date: Wed, 26 Jul 2023 20:43:37 +1000 >Subject: [PATCH] util: Avoid logging to multiple backends for stdout/stderr > >Commit 83fe7a0316d3e5867a56cfdc51ec17f36ea03889 converted the >stdout/stderr logging types to DEBUG_FILE to get a header when using >DEBUG_SYSLOG_FORMAT_ALWAYS. However, this causes all configured >backends to be invoked. When syslog is one of those backends then >this is almost certainly not what is intended. > >Instead, call debug_file_log() directly in that special case and >revert the parts of the above commit that convert to file logging. > >Most of the changes to debughdrclass() still seem necessary, since >they handle the change of debug_syslog_format from a bool to an enum. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15460 > >Signed-off-by: Martin Schwenke <mschwenke@ddn.com> >Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> > >Autobuild-User(master): Martin Schwenke <martins@samba.org> >Autobuild-Date(master): Mon Aug 28 01:21:07 UTC 2023 on atb-devel-224 > >(cherry picked from commit c7672779128ff12eb7a5cb34052559e62adbd5cb) >--- > lib/util/debug.c | 36 +++++++++++++----------------------- > 1 file changed, 13 insertions(+), 23 deletions(-) > >diff --git a/lib/util/debug.c b/lib/util/debug.c >index b83075cb239..0e13fa564e3 100644 >--- a/lib/util/debug.c >+++ b/lib/util/debug.c >@@ -1559,25 +1559,10 @@ void check_log_size( void ) > static void Debug1(const char *msg, size_t msg_len) > { > int old_errno = errno; >- enum debug_logtype logtype = state.logtype; > > debug_count++; > >- if (state.settings.debug_syslog_format == DEBUG_SYSLOG_FORMAT_ALWAYS) { >- switch(state.logtype) { >- case DEBUG_STDOUT: >- case DEBUG_STDERR: >- case DEBUG_DEFAULT_STDOUT: >- case DEBUG_DEFAULT_STDERR: >- /* Behave the same as logging to a file */ >- logtype = DEBUG_FILE; >- break; >- default: >- break; >- } >- } >- >- switch(logtype) { >+ switch(state.logtype) { > case DEBUG_CALLBACK: > debug_callback_log(msg, msg_len, current_msg_level); > break; >@@ -1585,13 +1570,18 @@ static void Debug1(const char *msg, size_t msg_len) > case DEBUG_STDERR: > case DEBUG_DEFAULT_STDOUT: > case DEBUG_DEFAULT_STDERR: >- if (dbgc_config[DBGC_ALL].fd > 0) { >- ssize_t ret; >- do { >- ret = write(dbgc_config[DBGC_ALL].fd, >- msg, >- msg_len); >- } while (ret == -1 && errno == EINTR); >+ if (state.settings.debug_syslog_format == >+ DEBUG_SYSLOG_FORMAT_ALWAYS) { >+ debug_file_log(current_msg_level, msg, msg_len); >+ } else { >+ if (dbgc_config[DBGC_ALL].fd > 0) { >+ ssize_t ret; >+ do { >+ ret = write(dbgc_config[DBGC_ALL].fd, >+ msg, >+ msg_len); >+ } while (ret == -1 && errno == EINTR); >+ } > } > break; > case DEBUG_FILE: >-- >2.39.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
abartlet
:
review+
Actions:
View
Attachments on
bug 15460
: 18071