From 22a7ef01aa2c0eb77bcc40174d09104acc35cab1 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 7 Jun 2016 10:59:46 +0200 Subject: Replace use of opt.homedir by accessor functions. * common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch --- dirmngr/server.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'dirmngr/server.c') diff --git a/dirmngr/server.c b/dirmngr/server.c index bca0d8ef2..6eb6f1bef 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -2440,22 +2440,13 @@ start_command_handler (assuan_fd_t fd) if (!hello_line) { - size_t n; - const char *cfgname; - - cfgname = opt.config_filename? opt.config_filename : "[none]"; - - n = (30 + strlen (opt.homedir) + strlen (cfgname) - + strlen (hello) + 1); - hello_line = xmalloc (n+1); - snprintf (hello_line, n, - "Home: %s\n" - "Config: %s\n" - "%s", - opt.homedir, - cfgname, - hello); - hello_line[n] = 0; + hello_line = xtryasprintf + ("Home: %s\n" + "Config: %s\n" + "%s", + gnupg_homedir (), + opt.config_filename? opt.config_filename : "[none]", + hello); } ctrl->server_local->assuan_ctx = ctx; -- cgit v1.2.3