aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-01 13:27:47 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-01 13:27:47 +0000
commit88f3b6efb4105b17998a22befdfd42244314935e (patch)
treea4b102d011c81fbcc9ac518c607121747a6b469c
parent598451429c20db4bbb2249f59d9641ad22126269 (diff)
downloadruby-88f3b6efb4105b17998a22befdfd42244314935e.tar.gz
* configure.in, hash.c (ruby_setenv): use setenv(3) and unsetenv(3)
where they are supported. modifing environ variable seems to segfault solaris 10. [ruby-core:7276] [ruby-dev:28270] * ruby.c (set_arg0): if use setenv(3), environ space cannot be used for altering argv[0]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--configure.in2
-rw-r--r--hash.c4
-rw-r--r--ruby.c11
4 files changed, 21 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 14cb1eab7b..9ad8a169e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Wed Feb 1 22:01:47 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
+
+ * configure.in, hash.c (ruby_setenv): use setenv(3) and unsetenv(3)
+ where they are supported. modifing environ variable seems to
+ segfault solaris 10. [ruby-core:7276] [ruby-dev:28270]
+
+ * ruby.c (set_arg0): if use setenv(3), environ space cannot be used
+ for altering argv[0].
+
Tue Jan 31 11:58:51 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/multi-tk.rb: add MultiTkIp#eval and bg_eval.
@@ -8,7 +17,7 @@ Tue Jan 31 11:58:51 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Tue Jan 31 00:08:22 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* ext/syck/rubyext.c (syck_resolver_transfer): workaround for SEGV.
- ex: YAML.load("!map:B {}"). [ruby-core:7217]
+ ex: ruby -ryaml -e 'YAML.load("!map:B {}")' [ruby-core:7217]
Sat Jan 28 07:49:30 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
diff --git a/configure.in b/configure.in
index 696e052022..05af353b29 100644
--- a/configure.in
+++ b/configure.in
@@ -506,7 +506,7 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot fsync getcwd
getpriority getrlimit setrlimit\
dlopen sigprocmask sigaction _setjmp vsnprintf snprintf\
setsid telldir seekdir fchmod mktime timegm cosh sinh tanh\
- setuid setgid daemon select_large_fdset)
+ setuid setgid daemon select_large_fdset setenv unsetenv)
AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according to need even if obsolete.],
[use_setreuid=$enableval])
diff --git a/hash.c b/hash.c
index a0af0fc5ce..53a0001318 100644
--- a/hash.c
+++ b/hash.c
@@ -196,8 +196,6 @@ rb_hash_foreach(VALUE hash, int (*func)(ANYARGS), VALUE farg)
rb_ensure(hash_foreach_call, (VALUE)&arg, hash_foreach_ensure, hash);
}
-static VALUE hash_alloc(VALUE);
-
static VALUE
hash_alloc(VALUE klass)
{
@@ -1690,7 +1688,7 @@ ruby_setenv(const char *name, const char *value)
* RTL's environ global variable directly yet.
*/
SetEnvironmentVariable(name,value);
-#elif defined __CYGWIN__
+#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
#undef setenv
#undef unsetenv
if (value)
diff --git a/ruby.c b/ruby.c
index 353040f89d..338631d186 100644
--- a/ruby.c
+++ b/ruby.c
@@ -987,7 +987,14 @@ VALUE rb_progname;
VALUE rb_argv;
VALUE rb_argv0;
-#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE) && !defined(DOSISH)
+#if defined(PSTAT_SETCMD) || defined(HAVE_SETPROCTITLE)
+#elif defined(_WIN32)
+#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
+#else
+#define USE_ENVSPACE_FOR_ARG0
+#endif
+
+#ifdef USE_ENVSPACE_FOR_ARG0
static struct {
char *begin, *end;
} envspace;
@@ -1061,7 +1068,7 @@ set_arg0(VALUE val, ID id)
break;
}
}
-#ifndef DOSISH
+#if defined(USE_ENVSPACE_FOR_ARG0)
if (s + 1 == envspace.begin) {
s = envspace.end;
ruby_setenv("", NULL); /* duplicate environ vars */