Skip to content

Commit 18fc751

Browse files
committed
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.
1 parent 1396a9b commit 18fc751

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ int git__getenv(git_buf *out, const char *name)
755755

756756
if (value_len)
757757
error = git_buf_put_w(out, wide_value, value_len);
758-
else if (GetLastError() == ERROR_ENVVAR_NOT_FOUND)
758+
else if (GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_ENVVAR_NOT_FOUND)
759759
error = GIT_ENOTFOUND;
760760
else
761761
git_error_set(GIT_ERROR_OS, "could not read environment variable '%s'", name);

0 commit comments

Comments
 (0)