1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

w32: Move socketdir to LOCAL_APPDATA

* common/homedir.c (is_gnupg_default_homedir): Use standard_homedir
instead of the constant which makes a difference on Windows.
(_gnupg_socketdir_internal) [W32]: Move the directory to LOCAL_APPDATA.
(gnupg_cachedir): Remove unsued function.

* common/sysutils.c (gnupg_rmdir): New.
* tools/gpgconf.c (main): s/rmdir/gnupg_rmdir/.
--

That is actually a more correct directory than APPDATA.  This fixes
a problem with installations where the APPDATA is non a network drive
and the resulting socket filename is truncated in our socket helper
function (because we use sockaddr also for our local socket
emulation on Windows).

LOCAL_APPDATA is expected to be on the local box and thus in the
majority of cases the resulting socket file name will be short enough.

GnuPG-bug-id: 5537
Signed-off-by: Werner Koch <wk@gnupg.org>
Backport-from-master: 0802cbb59b
This commit is contained in:
Werner Koch 2021-08-11 11:50:41 +02:00
parent 013f2e4672
commit 4dfa951a0a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
5 changed files with 160 additions and 77 deletions

View file

@ -1010,6 +1010,33 @@ gnupg_chdir (const char *name)
}
/* A wrapper around rmdir. NAME is expected to be utf8 encoded. */
int
gnupg_rmdir (const char *name)
{
#ifdef HAVE_W32_SYSTEM
int rc;
wchar_t *wfname;
wfname = utf8_to_wchar (name);
if (!wfname)
rc = 0;
else
{
rc = RemoveDirectoryW (wfname);
if (!rc)
gnupg_w32_set_errno (-1);
xfree (wfname);
}
if (!rc)
return -1;
return 0;
#else
return rmdir (name);
#endif
}
/* A wrapper around chmod which takes a string for the mode argument.
This makes it easier to handle the mode argument which is not
defined on all systems. The format of the modestring is the same