The Samba-Bugzilla – Attachment 10901 Details for
Bug 9955
Please implement command line option to log to syslog only
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
lib/debug.c
lib_debug.patch (text/plain), 2.66 KB, created by
Marcos Mello
on 2015-03-22 20:58:31 UTC
(
hide
)
Description:
lib/debug.c
Filename:
MIME Type:
Creator:
Marcos Mello
Created:
2015-03-22 20:58:31 UTC
Size:
2.66 KB
patch
obsolete
>--- lib/debug.c.orig 2009-05-23 17:30:48.000000000 +0000 >+++ lib/debug.c 2009-05-24 02:40:15.000000000 +0000 >@@ -119,6 +119,8 @@ > * > * syslog_level - Internal copy of the message debug level. Written by > * dbghdr() and read by Debug1(). >+ * >+ * syslog_only - Permanent syslog only logging flag > * > * format_bufr - Used to format debug messages. The dbgtext() function > * prints debug messages to a string, and then passes the >@@ -138,6 +140,7 @@ > static int debug_count = 0; > #ifdef WITH_SYSLOG > static int syslog_level = 0; >+static bool syslog_only = False; > #endif > static char *format_bufr = NULL; > static size_t format_pos = 0; >@@ -606,6 +609,15 @@ > } > > /*************************************************************************** >+ Set the syslog only flag. >+**************************************************************************/ >+ >+void debug_set_syslog_only( void ) >+{ >+ syslog_only = true; >+} >+ >+/*************************************************************************** > Set the logfile name. > **************************************************************************/ > >@@ -656,21 +668,26 @@ > } > > debugf = fname; >- new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); >+#ifdef WITH_SYSLOG >+ if( !syslog_only && !lp_syslog_only() ) >+#endif >+ { >+ new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); > >- if (!new_dbf) { >- log_overflow = True; >- DEBUG(0, ("Unable to open new log file %s: %s\n", debugf, strerror(errno))); >- log_overflow = False; >- if (dbf) >- x_fflush(dbf); >- ret = False; >- } else { >- x_setbuf(new_dbf, NULL); >- old_dbf = dbf; >- dbf = new_dbf; >- if (old_dbf) >- (void) x_fclose(old_dbf); >+ if (!new_dbf) { >+ log_overflow = True; >+ DEBUG(0, ("Unable to open new log file %s: %s\n", debugf, strerror(errno))); >+ log_overflow = False; >+ if (dbf) >+ x_fflush(dbf); >+ ret = False; >+ } else { >+ x_setbuf(new_dbf, NULL); >+ old_dbf = dbf; >+ dbf = new_dbf; >+ if (old_dbf) >+ (void) x_fclose(old_dbf); >+ } > } > > /* Fix from klausr@ITAP.Physik.Uni-Stuttgart.De >@@ -810,7 +827,7 @@ > goto done; > > #ifdef WITH_SYSLOG >- if( !lp_syslog_only() ) >+ if( !syslog_only && !lp_syslog_only() ) > #endif > { > if( !dbf ) { >@@ -828,7 +845,7 @@ > } > > #ifdef WITH_SYSLOG >- if( syslog_level < lp_syslog() ) { >+ if( syslog_level < lp_syslog() || syslog_only ) { > /* map debug levels to syslog() priorities > * note that not all DEBUG(0, ...) calls are > * necessarily errors */ >@@ -861,7 +878,7 @@ > check_log_size(); > > #ifdef WITH_SYSLOG >- if( !lp_syslog_only() ) >+ if( !syslog_only && !lp_syslog_only() ) > #endif > { > va_start( ap, format_str );
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
Actions:
View
Attachments on
bug 9955
: 10901 |
10902
|
10903
|
10904