aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-02-07 16:58:39 +0000
committerWerner Koch <[email protected]>2022-02-07 16:59:22 +0000
commit7d1215cb9cba258102b91c92e6973783e8d53b07 (patch)
tree4a1d7db8cffd04304ec78366f86fd1b11bfd54d1
parentpo: Update Japanese Translation. (diff)
downloadgnupg-7d1215cb9cba258102b91c92e6973783e8d53b07.tar.gz
gnupg-7d1215cb9cba258102b91c92e6973783e8d53b07.zip
common: Fix creation of Windows socket directories.
* common/homedir.c (w32_try_mkdir): Remove. (standard_homedir): Use gnupg_mkdir instead of w32_try_mkdir. (_gnupg_socketdir_internal): Ditto. -- The w32_try_mkdir was once introduced for WindowsCE and unfortunately at a too brief inspection it looks like it does the utf8->wchar conversion. Which it does not. Thus I obviously never tested the switch to from APPDATA to LOCAL_APPDATA with a non-ascii account name. That might have been due to the use of the very same code for the homedir - but there is other code in gpg to create the homedir; thus a failure here is mostly fixed later. The missing error diagnostic was - and is - on purpose to avoid such error messages due to a race between several running gpg instances. GnuPG-bug-id: 5537
-rw-r--r--common/homedir.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/common/homedir.c b/common/homedir.c
index 70507b533..9788c22f1 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -112,25 +112,6 @@ static const char *w32_rootdir (void);
#endif
-
-#ifdef HAVE_W32_SYSTEM
-static void
-w32_try_mkdir (const char *dir)
-{
-#ifdef HAVE_W32CE_SYSTEM
- wchar_t *wdir = utf8_to_wchar (dir);
- if (wdir)
- {
- CreateDirectory (wdir, NULL);
- xfree (wdir);
- }
-#else
- CreateDirectory (dir, NULL);
-#endif
-}
-#endif
-
-
/* This is a helper function to load and call a Windows function from
* either of one DLLs. On success an UTF-8 file name is returned.
* ERRNO is _not_ set on error. */
@@ -275,7 +256,7 @@ standard_homedir (void)
/* Try to create the directory if it does not yet exists. */
if (gnupg_access (dir, F_OK))
- w32_try_mkdir (dir);
+ gnupg_mkdir (dir, "-rwx");
}
else
dir = GNUPG_DEFAULT_HOMEDIR;
@@ -860,7 +841,7 @@ _gnupg_socketdir_internal (int skip_checks, unsigned *r_info)
name = xstrconcat (path, "\\gnupg", NULL);
xfree (path);
if (gnupg_access (name, F_OK))
- w32_try_mkdir (name);
+ gnupg_mkdir (name, "-rwx");
}
else
{