From c94ee1386e0d5cdac51086c4d5b92de59c09c9b5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 20 Oct 2020 10:43:55 +0200 Subject: 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 --- dirmngr/http.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'dirmngr/http.c') 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; -- cgit v1.2.3