diff options
| author | Philip Kelley <phkelley@hotmail.com> | 2012-11-01 11:50:08 -0400 |
|---|---|---|
| committer | Philip Kelley <phkelley@hotmail.com> | 2012-11-01 11:50:08 -0400 |
| commit | e068f2bb71c647c19713fd9fb53596c7eeddc777 (patch) | |
| tree | 94dd78789db2c45b063450dbb24494fa4c8e1edf /tests-clar/clar_helpers.c | |
| parent | 0ccfc63bd6f0759705001432a5e42d5f56650967 (diff) | |
| download | libgit2-e068f2bb71c647c19713fd9fb53596c7eeddc777.tar.gz | |
Fix a bug in cl_setenv on Windows XP
Diffstat (limited to 'tests-clar/clar_helpers.c')
| -rw-r--r-- | tests-clar/clar_helpers.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests-clar/clar_helpers.c b/tests-clar/clar_helpers.c index 647ea5201..250c9223b 100644 --- a/tests-clar/clar_helpers.c +++ b/tests-clar/clar_helpers.c @@ -89,7 +89,11 @@ int cl_setenv(const char *name, const char *value) if (value != NULL) git__utf8_to_16(value_utf16, GIT_WIN_PATH, value); - cl_assert(SetEnvironmentVariableW(name_utf16, value ? value_utf16 : NULL)); + /* Windows XP returns 0 (failed) when passing NULL for lpValue when lpName + * does not exist in the environment block. This behavior seems to have changed + * in later versions. Don't fail when SetEnvironmentVariable fails, if we passed + * NULL for lpValue. */ + cl_assert(SetEnvironmentVariableW(name_utf16, value ? value_utf16 : NULL) || !value); return 0; } |
