Skip to content

Commit

Permalink
merge revision(s) 25766:
Browse files Browse the repository at this point in the history
	* hash.c (ruby_setenv): get rid of crash in Solaris 8 and 10.
	  [ruby-core:26668]


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@26087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Dec 14, 2009
1 parent 909d046 commit 21b7491
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Mon Dec 14 11:40:35 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>

* hash.c (ruby_setenv): get rid of crash in Solaris 8 and 10.
[ruby-core:26668]

Mon Dec 14 11:31:58 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org>

* lib/cgi.rb: fix command-line option of
Expand Down
29 changes: 28 additions & 1 deletion hash.c
Expand Up @@ -1947,7 +1947,19 @@ rb_env_path_tainted()
return path_tainted;
}

#if !defined(_WIN32) && !(defined(HAVE_SETENV) && defined(HAVE_UNSETENV))
#if defined(_WIN32) || (defined(HAVE_SETENV) && defined(HAVE_UNSETENV))
#elif defined __sun__
static int
in_origenv(str)
const char *str;
{
char **env;
for (env = origenviron; *env; ++env) {
if (*env == str) return 1;
}
return 0;
}
#else
static int
envix(nam)
const char *nam;
Expand Down Expand Up @@ -2002,6 +2014,21 @@ ruby_setenv(name, value)
setenv(name,value,1);
else
unsetenv(name);
#elif defined __sun__
size_t len = strlen(name);
char **env_ptr, *str;
for (env_ptr = GET_ENVIRON(environ); (str = *env_ptr) != 0; ++env_ptr) {
if (!strncmp(str, name, len) && str[len] == '=') {
if (!in_origenv(str)) free(str);
while ((env_ptr[0] = env_ptr[1]) != 0) env_ptr++;
break;
}
}
if (value) {
str = malloc(len += strlen(value) + 2);
snprintf(str, len, "%s=%s", name, value);
putenv(str);
}
#else /* WIN32 */
size_t len;
int i=envix(name); /* where does it go? */
Expand Down
2 changes: 1 addition & 1 deletion version.h
Expand Up @@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2009-12-14"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20091214
#define RUBY_PATCHLEVEL 231
#define RUBY_PATCHLEVEL 232

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
Expand Down

0 comments on commit 21b7491

Please sign in to comment.