1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-14 21:47:19 +02:00

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 <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-06-07 10:59:46 +02:00
parent 650abbab71
commit 22a7ef01aa
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
44 changed files with 188 additions and 179 deletions

View file

@ -747,7 +747,7 @@ opendb (char *filename, enum db_type type)
log_assert (! filename);
log_assert (type == DB_COMBINED);
filename = make_filename (opt.homedir, "tofu.db", NULL);
filename = make_filename (gnupg_homedir (), "tofu.db", NULL);
filename_free = 1;
}
else
@ -895,10 +895,10 @@ getdb (tofu_dbs_t dbs, const char *name, enum db_type type)
char *name_db;
/* Make the directory. */
rc = gnupg_mkdir_p (opt.homedir, "tofu.d", type_str, prefix, NULL);
rc = gnupg_mkdir_p (gnupg_homedir (), "tofu.d", type_str, prefix, NULL);
if (rc)
{
name_db = xstrconcat (opt.homedir, "tofu.d",
name_db = xstrconcat (gnupg_homedir (), "tofu.d",
type_str, prefix, NULL);
log_error (_("can't create directory '%s': %s\n"),
name_db, gpg_strerror (rc));
@ -908,7 +908,7 @@ getdb (tofu_dbs_t dbs, const char *name, enum db_type type)
name_db = xstrconcat (name_sanitized, ".db", NULL);
filename = make_filename
(opt.homedir, "tofu.d", type_str, prefix, name_db, NULL);
(gnupg_homedir (), "tofu.d", type_str, prefix, name_db, NULL);
xfree (name_db);
}
}
@ -989,7 +989,7 @@ opendbs (ctrl_t ctrl)
if (opt.tofu_db_format == TOFU_DB_AUTO)
{
char *filename = make_filename (opt.homedir, "tofu.db", NULL);
char *filename = make_filename (gnupg_homedir (), "tofu.db", NULL);
struct stat s;
int have_tofu_db = 0;
int have_tofu_d = 0;