From 88f3b6efb4105b17998a22befdfd42244314935e Mon Sep 17 00:00:00 2001 From: ocean Date: Wed, 1 Feb 2006 13:27:47 +0000 Subject: * 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 --- ruby.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ruby.c') 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 */ -- cgit v1.2.3