summaryrefslogtreecommitdiff
path: root/lib/util/debug.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-06-11 18:53:14 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-06-11 18:54:32 +1000
commite5353ce95bbfeab79b6055b1acf07a04b0f3e22a (patch)
treea18b65d4819f59ae181006408161c9210d65661a /lib/util/debug.c
parent6372bd695d96d2bfa8a8f902dd0e3830f7b3c2e6 (diff)
downloadsamba-e5353ce95bbfeab79b6055b1acf07a04b0f3e22a.tar.gz
samba-e5353ce95bbfeab79b6055b1acf07a04b0f3e22a.tar.bz2
samba-e5353ce95bbfeab79b6055b1acf07a04b0f3e22a.zip
Don't recurse in reopen_logs().
Use the state to avoid recursion in reopen_logs(), as DEBUG() can call this function. Andrew Bartlett
Diffstat (limited to 'lib/util/debug.c')
-rw-r--r--lib/util/debug.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 578822088f..58905187ee 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -50,6 +50,7 @@ static struct {
int fd;
enum debug_logtype logtype;
const char *prog_name;
+ bool reopening_logs;
} state;
static bool reopen_logs_scheduled;
@@ -139,6 +140,9 @@ _PUBLIC_ void reopen_logs(void)
{
char *fname = NULL;
int old_fd = state.fd;
+ if (state.reopening_logs) {
+ return;
+ }
switch (state.logtype) {
case DEBUG_STDOUT:
@@ -150,6 +154,7 @@ _PUBLIC_ void reopen_logs(void)
break;
case DEBUG_FILE:
+ state.reopening_logs = true;
if (logfile && (*logfile) == '/') {
fname = strdup(logfile);
} else {
@@ -167,6 +172,7 @@ _PUBLIC_ void reopen_logs(void)
} else {
DEBUG(1, ("Failed to find name for file-based logfile!\n"));
}
+ state.reopening_false = true;
break;
}