1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c (rb_w32_getenv): should return NULL if specified name

is empty. a patch from Heesob Park at [ruby-core:32650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2010-09-30 07:12:49 +00:00
parent 85bcd25877
commit 1fcb7a5ee0
3 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Thu Sep 30 16:11:08 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (rb_w32_getenv): should return NULL if specified name
is empty. a patch from Heesob Park at [ruby-core:32650]
Thu Sep 30 10:55:38 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* hash.c (ruby_setenv): workaround for old Windows. a patch from

View file

@ -96,6 +96,7 @@ class TestEnv < Test::Unit::TestCase
assert_raise(ArgumentError) { ENV["foo\0bar"] }
ENV[PATH_ENV] = ""
assert_equal("", ENV[PATH_ENV])
assert_nil(ENV[""])
end
def test_fetch

View file

@ -3900,8 +3900,8 @@ rb_w32_getenv(const char *name)
int len = strlen(name);
char *env;
if (envarea)
FreeEnvironmentStrings(envarea);
if (len == 0) return NULL;
if (envarea) FreeEnvironmentStrings(envarea);
envarea = GetEnvironmentStrings();
if (!envarea) {
map_errno(GetLastError());