summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-10-14 07:06:08 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2022-10-14 07:06:08 +0200
commitfe28e088a9c2d4945b720b045b4fa74d2de3d895 (patch)
tree50fe965d455cb958c20323cde0f5c5403fa3979e /common
parentagent,w32: Support Win32-OpenSSH emulation by gpg-agent. (diff)
downloadgnupg2-fe28e088a9c2d4945b720b045b4fa74d2de3d895.tar.xz
gnupg2-fe28e088a9c2d4945b720b045b4fa74d2de3d895.zip
common,w32: Fix struct stat on Windows.
* common/sysutils.c [HAVE_W32_SYSTEM] (gnupg_stat): Select appropriate structure. -- GnuPG-bug-id: 5897 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'common')
-rw-r--r--common/sysutils.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/sysutils.c b/common/sysutils.c
index c30f9a0ce..bbed309a8 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -1237,10 +1237,20 @@ int
gnupg_stat (const char *name, struct stat *statbuf)
{
# ifdef HAVE_W32_SYSTEM
+# if __MINGW32_MAJOR_VERSION > 3
+ /* mingw.org's MinGW */
+# define STRUCT_STAT _stat
+# elif defined(_USE_32BIT_TIME_T)
+ /* MinGW64 for i686 */
+# define STRUCT_STAT _stat32
+# else
+ /* MinGW64 for x86_64 */
+# define STRUCT_STAT _stat64i32
+# endif
if (any8bitchar (name))
{
wchar_t *wname;
- struct _stat32 st32;
+ struct STRUCT_STAT st32;
int ret;
wname = utf8_to_wchar (name);