]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- For #52 #53, second context does not close logfile override.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 1 Aug 2019 07:15:33 +0000 (09:15 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 1 Aug 2019 07:15:33 +0000 (09:15 +0200)
doc/Changelog
libunbound/context.c
libunbound/context.h
libunbound/libunbound.c

index 6100d9a04d3ef7e710b653570c54e1047dcf002b..50175902ee837c05088aceae7c11b18c2fc8588c 100644 (file)
@@ -1,3 +1,6 @@
+1 August 2019: Wouter
+       - For #52 #53, second context does not close logfile override.
+
 29 July 2019: Wouter
        - Add verbose log message when auth zone file is written, at level 4.
        - Add hex print of trust anchor pointer to trust anchor file temp
index 20e3680ec3bca96079abdda2193ffa1973b87592..6d8b7b7b5da922be66de1b20b4d53e9bf91e7877 100644 (file)
@@ -57,9 +57,16 @@ context_finalize(struct ub_ctx* ctx)
 {
        struct config_file* cfg = ctx->env->cfg;
        verbosity = cfg->verbosity;
-       if(ctx->logfile_override)
+       if(ctx_logfile_overridden) {
+               log_file(NULL); /* clear that override */
+               ctx_logfile_overridden = 0;
+       }
+       if(ctx->logfile_override) {
+               ctx_logfile_overridden = 1;
                log_file(ctx->log_out);
-       else    log_init(cfg->logfile, cfg->use_syslog, NULL);
+       } else {
+               log_init(cfg->logfile, cfg->use_syslog, NULL);
+       }
        config_apply(cfg);
        if(!modstack_setup(&ctx->mods, cfg->module_conf, ctx->env))
                return UB_INITFAIL;
index 11147226a8cc687cc84b9f46a55d7e023f3b325b..c3900154f8b439caafa3ecada45c8ff28365c083 100644 (file)
@@ -52,6 +52,9 @@ struct tube;
 struct sldns_buffer;
 struct ub_event_base;
 
+/** store that the logfile has a debug override */
+extern int ctx_logfile_overridden;
+
 /**
  * The context structure
  *
index 9dd7d6dbeabd5a32fbd51ab756e7b250cb0c025d..b5f1137b8180e1d5dc2fcdbb26c7db6deb94bc83 100644 (file)
@@ -79,6 +79,9 @@
 #include <iphlpapi.h>
 #endif /* UB_ON_WINDOWS */
 
+/** store that the logfile has a debug override */
+int ctx_logfile_overridden = 0;
+
 /** create context functionality, but no pipes */
 static struct ub_ctx* ub_ctx_create_nopipe(void)
 {
@@ -328,8 +331,10 @@ ub_ctx_delete(struct ub_ctx* ctx)
        ub_randfree(ctx->seed_rnd);
        alloc_clear(&ctx->superalloc);
        traverse_postorder(&ctx->queries, delq, NULL);
-       if(ctx->logfile_override)
+       if(ctx_logfile_overridden) {
                log_file(NULL);
+               ctx_logfile_overridden = 0;
+       }
        free(ctx);
 #ifdef USE_WINSOCK
        WSACleanup();