diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-20 13:07:37 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-20 13:13:31 -0400 |
commit | 18fc751e00cfaeed17ad9360b06c07723c0b90fc (patch) | |
tree | 1f4c4edf5264cc61f5ccf86cf7b3af1cc698a23a | |
parent | 1396a9b556ce60da01c99b009ef91d22e5404702 (diff) | |
download | libgit2-18fc751e00cfaeed17ad9360b06c07723c0b90fc.tar.gz |
win32: allow empty environment variables
A length of 0 indicates an error and GetLastError() will be set. If
GetLastError() is unset then the environment variable has a length of 0.
-rw-r--r-- | src/util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index c7af2961a..9b0c45ce8 100644 --- a/src/util.c +++ b/src/util.c @@ -755,7 +755,7 @@ int git__getenv(git_buf *out, const char *name) if (value_len) error = git_buf_put_w(out, wide_value, value_len); - else if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) + else if (GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_ENVVAR_NOT_FOUND) error = GIT_ENOTFOUND; else git_error_set(GIT_ERROR_OS, "could not read environment variable '%s'", name); |