* hash.c (ruby_setenv): ENV.[]= should raise an error if setenv(3)
or putenv(3) fails. [ruby-dev:40023] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
73cd7b6697
commit
af23025d77
@ -1,3 +1,8 @@
|
||||
Mon Jan 11 12:47:58 2010 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* hash.c (ruby_setenv): ENV.[]= should raise an error if setenv(3)
|
||||
or putenv(3) fails. [ruby-dev:40023]
|
||||
|
||||
Sun Jan 10 17:25:24 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/webrick/accesslog.rb : Escape needed.
|
||||
|
1
NEWS
1
NEWS
@ -45,6 +45,7 @@ with all sufficient information, see the ChangeLog file.
|
||||
|
||||
* ENV
|
||||
* Uses locale's encoding
|
||||
* ENV.[]= raises Errno::{EINVAL,ENOMEM} etc. on failure.
|
||||
|
||||
* Float
|
||||
* new constants:
|
||||
|
14
hash.c
14
hash.c
@ -2064,10 +2064,13 @@ ruby_setenv(const char *name, const char *value)
|
||||
#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
|
||||
#undef setenv
|
||||
#undef unsetenv
|
||||
if (value)
|
||||
setenv(name,value,1);
|
||||
else
|
||||
unsetenv(name);
|
||||
if (value) {
|
||||
if (setenv(name, value, 1))
|
||||
rb_sys_fail("setenv");
|
||||
} else {
|
||||
if (unsetenv(name))
|
||||
rb_sys_fail("unsetenv");
|
||||
}
|
||||
#elif defined __sun__
|
||||
size_t len = strlen(name);
|
||||
char **env_ptr, *str;
|
||||
@ -2081,7 +2084,8 @@ ruby_setenv(const char *name, const char *value)
|
||||
if (value) {
|
||||
str = malloc(len += strlen(value) + 2);
|
||||
snprintf(str, len, "%s=%s", name, value);
|
||||
putenv(str);
|
||||
if (putenv(str))
|
||||
rb_sys_fail("putenv");
|
||||
}
|
||||
#else /* WIN32 */
|
||||
size_t len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user