aboutsummaryrefslogtreecommitdiffstats
path: root/common/sysutils.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-05-16 07:25:13 +0000
committerNIIBE Yutaka <[email protected]>2023-05-16 07:25:13 +0000
commit86cdb49097a1ed08870a51fe5e4eb72aae6742d2 (patch)
tree883fbb6a4aafd9656f41715b40a579b732d57a75 /common/sysutils.c
parentw32: Remove support of Windows 95/98/Me. (diff)
downloadgnupg-86cdb49097a1ed08870a51fe5e4eb72aae6742d2.tar.gz
gnupg-86cdb49097a1ed08870a51fe5e4eb72aae6742d2.zip
w32: Use _putenv_s.
* common/sysutils.c (gnupg_setenv): Use _putenv_s. -- This may break build on original MinGW, but works well with MinGW-W64. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'common/sysutils.c')
-rw-r--r--common/sysutils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/sysutils.c b/common/sysutils.c
index 01510ddb0..0c2831541 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -1148,6 +1148,19 @@ gnupg_setenv (const char *name, const char *value, int overwrite)
return setenv (name, value, overwrite);
#else /*!HAVE_SETENV*/
if (! getenv (name) || overwrite)
+#ifdef HAVE_W32_SYSTEM
+ {
+ int e = _putenv_s (name, value);
+
+ if (e)
+ {
+ gpg_err_set_errno (e);
+ return -1;
+ }
+ else
+ return 0;
+ }
+#else
{
char *buf;
@@ -1165,6 +1178,7 @@ gnupg_setenv (const char *name, const char *value, int overwrite)
# endif
return putenv (buf);
}
+#endif /*!HAVE_W32_SYSTEM*/
return 0;
#endif /*!HAVE_SETENV*/
}