Commit 18fc751e by Edward Thomson

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.
parent 1396a9b5
...@@ -755,7 +755,7 @@ int git__getenv(git_buf *out, const char *name) ...@@ -755,7 +755,7 @@ int git__getenv(git_buf *out, const char *name)
if (value_len) if (value_len)
error = git_buf_put_w(out, wide_value, 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; error = GIT_ENOTFOUND;
else else
git_error_set(GIT_ERROR_OS, "could not read environment variable '%s'", name); git_error_set(GIT_ERROR_OS, "could not read environment variable '%s'", name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment