From: W.C.A. Wijngaards Date: Thu, 1 Aug 2019 07:34:44 +0000 (+0200) Subject: - Fix #52 #53, fix for example fail program. X-Git-Tag: release-1.9.3rc1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21f740d3134eb4158606e7ebdef45c93024e33fd;p=thirdparty%2Funbound.git - Fix #52 #53, fix for example fail program. --- diff --git a/doc/Changelog b/doc/Changelog index 50175902e..7042734d8 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,6 @@ 1 August 2019: Wouter - For #52 #53, second context does not close logfile override. + - Fix #52 #53, fix for example fail program. 29 July 2019: Wouter - Add verbose log message when auth zone file is written, at level 4. diff --git a/libunbound/context.c b/libunbound/context.c index 6d8b7b7b5..b8fe87d2e 100644 --- a/libunbound/context.c +++ b/libunbound/context.c @@ -57,7 +57,7 @@ context_finalize(struct ub_ctx* ctx) { struct config_file* cfg = ctx->env->cfg; verbosity = cfg->verbosity; - if(ctx_logfile_overridden) { + if(ctx_logfile_overridden && !ctx->logfile_override) { log_file(NULL); /* clear that override */ ctx_logfile_overridden = 0; } diff --git a/libunbound/libunbound.c b/libunbound/libunbound.c index b5f1137b8..263dde5a4 100644 --- a/libunbound/libunbound.c +++ b/libunbound/libunbound.c @@ -93,7 +93,8 @@ static struct ub_ctx* ub_ctx_create_nopipe(void) #endif checklock_start(); - log_init(NULL, 0, NULL); /* logs to stderr */ + if(!ctx_logfile_overridden) + log_init(NULL, 0, NULL); /* logs to stderr */ log_ident_set("libunbound"); #ifdef USE_WINSOCK if((r = WSAStartup(MAKEWORD(2,2), &wsa_data)) != 0) { @@ -476,6 +477,7 @@ int ub_ctx_debugout(struct ub_ctx* ctx, void* out) { lock_basic_lock(&ctx->cfglock); log_file((FILE*)out); + ctx_logfile_overridden = 1; ctx->logfile_override = 1; ctx->log_out = out; lock_basic_unlock(&ctx->cfglock);