summaryrefslogtreecommitdiffstats
path: root/src/H5system.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5system.c')
-rw-r--r--src/H5system.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/H5system.c b/src/H5system.c
index 144e0bc..7dd0b74 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -460,6 +460,9 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
* Interestingly, getenv *is* available in the Windows
* POSIX layer, just not setenv.
*
+ * Note: Passing an empty string ("") for the value will remove
+ * the variable from the environment (like unsetenv(3))
+ *
* Return: Success: 0
* Failure: non-zero error code
*
@@ -471,14 +474,14 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
int
Wsetenv(const char *name, const char *value, int overwrite)
{
- size_t bufsize;
- errno_t err;
-
/* If we're not overwriting, check if the environment variable exists.
* If it does (i.e.: the required buffer size to store the variable's
* value is non-zero), then return an error code.
*/
if (!overwrite) {
+ size_t bufsize;
+ errno_t err;
+
err = getenv_s(&bufsize, NULL, 0, name);
if (err || bufsize)
return (int)err;