diff options
author | Werner Koch <wk@gnupg.org> | 2020-10-20 10:43:55 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2020-10-20 12:15:55 +0200 |
commit | c94ee1386e0d5cdac51086c4d5b92de59c09c9b5 (patch) | |
tree | 34089b99da850a449f95ab9dd7e88317194b5f11 /dirmngr | |
parent | gpg,ecc: Fix SOS handling when receiving from agent. (diff) | |
download | gnupg2-c94ee1386e0d5cdac51086c4d5b92de59c09c9b5.tar.xz gnupg2-c94ee1386e0d5cdac51086c4d5b92de59c09c9b5.zip |
Replace all calls to access by gnupg_access
* common/sysutils.c (gnupg_access): New. Replace all calls to access
by this wrapper.
* common/homedir.c (w32_shgetfolderpath): Change to return UTF-8
directory name.
(standard_homedir): Adjust for change.
(w32_commondir, gnupg_cachedir): Ditto.
--
Also use SHGetFolderPathW instead of SHGetFolderPathA on Windows.
This is required to correctly handle non-ascii filenames on Windows.
GnuPG-bug-id: 5098
Diffstat (limited to 'dirmngr')
-rw-r--r-- | dirmngr/certcache.c | 2 | ||||
-rw-r--r-- | dirmngr/dirmngr.c | 2 | ||||
-rw-r--r-- | dirmngr/http.c | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/dirmngr/certcache.c b/dirmngr/certcache.c index 87f605eab..04da510a0 100644 --- a/dirmngr/certcache.c +++ b/dirmngr/certcache.c @@ -685,7 +685,7 @@ load_certs_from_system (void) gpg_error_t err = 0; for (idx=0; idx < DIM (table); idx++) - if (!access (table[idx].name, F_OK)) + if (!gnupg_access (table[idx].name, F_OK)) { /* Take the first available bundle. */ err = load_certs_from_file (table[idx].name, CERTTRUST_CLASS_SYSTEM, 0); diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 3f07b2eac..a7b0cc051 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1099,7 +1099,7 @@ main (int argc, char **argv) log_info (_("Note: '%s' is not considered an option\n"), argv[i]); } - if (!access ("/etc/"DIRMNGR_NAME, F_OK) + if (!gnupg_access ("/etc/"DIRMNGR_NAME, F_OK) && !strncmp (gnupg_homedir (), "/etc/", 5)) log_info ("NOTE: DirMngr is now a proper part of %s. The configuration and" diff --git a/dirmngr/http.c b/dirmngr/http.c index bfbc30276..f7f65303b 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -577,6 +577,7 @@ http_register_tls_callback (gpg_error_t (*cb)(http_t, http_session_t, int)) void http_register_tls_ca (const char *fname) { + gpg_err_code_t ec; strlist_t sl; if (!fname) @@ -588,9 +589,8 @@ http_register_tls_ca (const char *fname) { /* Warn if we can't access right now, but register it anyway in case it becomes accessible later */ - if (access (fname, F_OK)) - log_info (_("can't access '%s': %s\n"), fname, - gpg_strerror (gpg_error_from_syserror())); + if ((ec = gnupg_access (fname, F_OK))) + log_info (_("can't access '%s': %s\n"), fname, gpg_strerror (ec)); sl = add_to_strlist (&tls_ca_certlist, fname); if (*sl->d && !strcmp (sl->d + strlen (sl->d) - 4, ".pem")) sl->flags = 1; @@ -606,6 +606,7 @@ http_register_tls_ca (const char *fname) void http_register_cfg_ca (const char *fname) { + gpg_err_code_t ec; strlist_t sl; if (!fname) @@ -617,9 +618,8 @@ http_register_cfg_ca (const char *fname) { /* Warn if we can't access right now, but register it anyway in case it becomes accessible later */ - if (access (fname, F_OK)) - log_info (_("can't access '%s': %s\n"), fname, - gpg_strerror (gpg_error_from_syserror())); + if ((ec = gnupg_access (fname, F_OK))) + log_info (_("can't access '%s': %s\n"), fname, gpg_strerror (ec)); sl = add_to_strlist (&cfg_ca_certlist, fname); if (*sl->d && !strcmp (sl->d + strlen (sl->d) - 4, ".pem")) sl->flags = 1; |