summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-12-12 22:46:49 +0100
committerJeremy Allison <jra@samba.org>2018-12-20 03:19:27 +0100
commit08d37b4a44bc7daed3c1c5774a3d7e796de582ef (patch)
tree787529a64779c229baa3e27ec86e904efbb62fad
parent3dbda63284cdeb2f060931c85388842627c955a1 (diff)
downloadsamba-08d37b4a44bc7daed3c1c5774a3d7e796de582ef.tar.gz
debug: enable per debug-class logfiles
This finally enables per debug-class logfiles by hooking into reopen_logs_internal() calls to reopen_one_log() per configured debug-class. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/util/debug.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 278562596fa..30e5a28a233 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -1078,6 +1078,12 @@ static bool reopen_one_log(int *fd, const char *logfile)
int old_fd = *fd;
int new_fd;
+ if (logfile == NULL) {
+ debug_close_fd(old_fd);
+ *fd = -1;
+ return true;
+ }
+
new_fd = open(logfile, O_WRONLY|O_APPEND|O_CREAT, 0644);
if (new_fd == -1) {
log_overflow = true;
@@ -1143,8 +1149,13 @@ bool reopen_logs_internal(void)
state.reopening_logs = true;
- ok = reopen_one_log(&dbgc_config[DBGC_ALL].fd,
- dbgc_config[DBGC_ALL].logfile);
+ for (i = DBGC_ALL; i < debug_num_classes; i++) {
+ ok = reopen_one_log(&dbgc_config[i].fd,
+ dbgc_config[i].logfile);
+ if (!ok) {
+ break;
+ }
+ }
/* Fix from klausr@ITAP.Physik.Uni-Stuttgart.De
* to fix problem where smbd's that generate less