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

* 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
This commit is contained in:
ocean 2006-02-01 13:27:47 +00:00
parent 598451429c
commit 88f3b6efb4
4 changed files with 21 additions and 7 deletions

View file

@ -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>

View file

@ -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])

4
hash.c
View file

@ -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)

11
ruby.c
View file

@ -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 */