1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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
This commit is contained in:
Werner Koch 2022-02-07 17:58:39 +01:00
parent 8021fe7670
commit 7d1215cb9c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -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
{