Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge revision(s) 25766:

	* 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...
commit 21b74912aa06acd6e562c9d17c24c521c8c40e11 1 parent 909d046
@shyouhei shyouhei authored
Showing with 34 additions and 2 deletions.
  1. +5 −0 ChangeLog
  2. +28 −1 hash.c
  3. +1 −1  version.h
View
5 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
View
29 hash.c
@@ -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;
@@ -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? */
View
2  version.h
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.