]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/debug: assert file backend
authorRalph Boehme <slow@samba.org>
Tue, 30 Jun 2020 15:02:07 +0000 (17:02 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 9 Jul 2020 11:40:24 +0000 (11:40 +0000)
The debug file backend is a built-in default, if it's missing we're totally
screwed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14426

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 5aeaa6959da326095e98f0369b6d91dc5667415e)

lib/util/debug.c

index d990a6bf2b0317ecfefc6b798ce640f3698c7e49..864adbeeec453c6c39c26bc15dd8cb409fda0520 100644 (file)
@@ -30,6 +30,7 @@
 #include "util_strlist.h" /* LIST_SEP */
 #include "blocking.h"
 #include "debug.h"
+#include <assert.h>
 
 /* define what facility to use for syslog */
 #ifndef SYSLOG_FACILITY
@@ -1113,6 +1114,7 @@ static bool reopen_one_log(int *fd, const char *logfile)
 */
 bool reopen_logs_internal(void)
 {
+       struct debug_backend *b = NULL;
        mode_t oldumask;
        int new_fd = 0;
        size_t i;
@@ -1140,15 +1142,13 @@ bool reopen_logs_internal(void)
                dbgc_config[DBGC_ALL].fd = 2;
                return true;
 
-       case DEBUG_FILE: {
-               struct debug_backend *b = debug_find_backend("file");
+       case DEBUG_FILE:
+               b = debug_find_backend("file");
+               assert(b != NULL);
 
-               if (b != NULL) {
-                       b->log_level = dbgc_config[DBGC_ALL].loglevel;
-               }
+               b->log_level = dbgc_config[DBGC_ALL].loglevel;
                break;
        }
-       }
 
        oldumask = umask( 022 );