debug: ignore debug_set_logfile() with a blank string
authorAndrew Tridgell <tridge@samba.org>
Tue, 29 Mar 2011 03:41:58 +0000 (14:41 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 29 Mar 2011 05:03:58 +0000 (07:03 +0200)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Tue Mar 29 07:03:58 CEST 2011 on sn-devel-104

lib/util/debug.c

index c7ba19e3ccd1f5a1d70f200ca905198485464dad..2ff7cb2c588c07e1d994174603f23889be601ed2 100644 (file)
@@ -493,6 +493,10 @@ void setup_logging(const char *prog_name, enum debug_logtype new_logtype)
 
 void debug_set_logfile(const char *name)
 {
+       if (name == NULL || *name == 0) {
+               /* this copes with calls when smb.conf is not loaded yet */
+               return;
+       }
        TALLOC_FREE(state.debugf);
        state.debugf = talloc_strdup(NULL, name);
 }
@@ -564,7 +568,7 @@ bool reopen_logs_internal(void)
 
        if (new_fd == -1) {
                log_overflow = true;
-               DEBUG(0, ("Unable to open new log file %s: %s\n", state.debugf, strerror(errno)));
+               DEBUG(0, ("Unable to open new log file '%s': %s\n", state.debugf, strerror(errno)));
                log_overflow = false;
                ret = false;
        } else {