From fb81820796349ec353622b08f1391bcecab53582 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 15 Oct 2013 18:27:27 +0200 Subject: [PATCH] windows: Provide a setenv() wrapper --- src/libstrongswan/utils/windows.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libstrongswan/utils/windows.h b/src/libstrongswan/utils/windows.h index 24c9d8a58..c0a5198a5 100644 --- a/src/libstrongswan/utils/windows.h +++ b/src/libstrongswan/utils/windows.h @@ -143,6 +143,18 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result) return ret; } +/** + * setenv(3) from , overwrite flag is ignored + */ +static inline int setenv(const char *name, const char *value, int overwrite) +{ + if (SetEnvironmentVariableA(name, value) == 0) + { /* failed */ + return -1; + } + return 0; +} + /** * dlerror(3) from , printing error to an alloca() buffer */