Skip to content

Commit

Permalink
Fix #11170, accessing empty env var on Windows
Browse files Browse the repository at this point in the history
(cherry picked from commit 2a86ef1)
ref PR #11210

Conflicts:
	base/env.jl
  • Loading branch information
tkelman committed May 14, 2015
1 parent 68969d7 commit b1e665c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _hasenv(s::String) = _hasenv(utf16(s))
function _jl_win_getenv(s::UTF16String,len::Uint32)
val=zeros(Uint16,len)
ret=ccall(:GetEnvironmentVariableW,stdcall,Uint32,(Ptr{Uint16},Ptr{Uint16},Uint32),s,val,len)
if ret==0 || ret != len-1 || val[end] != 0
if (ret==0 && len != 1) || ret != len-1 || val[end] != 0
error(string("system error getenv: ", s, ' ', len, "-1 != ", ret, ": ", FormatMessage()))
end
val
Expand Down

0 comments on commit b1e665c

Please sign in to comment.