aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c
diff options
context:
space:
mode:
Diffstat (limited to 'dirmngr/dirmngr.c')
-rw-r--r--dirmngr/dirmngr.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 33de686f5..38ae1c6ed 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -71,6 +71,7 @@
#if USE_LDAP
# include "ldap-wrapper.h"
#endif
+#include "../common/comopt.h"
#include "../common/init.h"
#include "../common/gc-opt-flags.h"
#include "dns-stuff.h"
@@ -1072,6 +1073,14 @@ main (int argc, char **argv)
if (log_get_errorcount(0))
exit(2);
+
+ /* Get a default log file from common.conf. */
+ if (!logfile && !parse_comopt (GNUPG_MODULE_NAME_DIRMNGR, debug_argparser))
+ {
+ logfile = comopt.logfile;
+ comopt.logfile = NULL;
+ }
+
if (nogreeting )
greeting = 0;
@@ -1806,9 +1815,10 @@ reread_configuration (void)
gpgrt_argparse_t pargs;
char *twopart;
int dummy;
+ int logfile_seen = 0;
if (!opt.config_filename)
- return; /* No config file. */
+ goto finish; /* No config file. */
twopart = strconcat (DIRMNGR_NAME EXTSEP_S "conf" PATHSEP_S,
opt.config_filename, NULL);
@@ -1833,11 +1843,28 @@ reread_configuration (void)
else if (pargs.r_opt < -1)
pargs.err = ARGPARSE_PRINT_WARNING;
else /* Try to parse this option - ignore unchangeable ones. */
- parse_rereadable_options (&pargs, 1);
+ {
+ if (pargs.r_opt == oLogFile)
+ logfile_seen = 1;
+ parse_rereadable_options (&pargs, 1);
+ }
}
gpgrt_argparse (NULL, &pargs, NULL); /* Release internal state. */
xfree (twopart);
post_option_parsing ();
+
+ finish:
+ /* Get a default log file from common.conf. */
+ if (!logfile_seen && !parse_comopt (GNUPG_MODULE_NAME_DIRMNGR, !!opt.debug))
+ {
+ if (!current_logfile || !comopt.logfile
+ || strcmp (current_logfile, comopt.logfile))
+ {
+ log_set_file (comopt.logfile);
+ xfree (current_logfile);
+ current_logfile = comopt.logfile? xtrystrdup (comopt.logfile) : NULL;
+ }
+ }
}