зеркало из https://github.com/github/ruby.git
* configure.in: test unsetenv returns a value.
unsetenv is void in older BSDs (FreeBSD 6 and OpenBSD 4.5 at least). * hash.c (ruby_setenv): don't use the result of unsetenv if unsetenv doesn't return a value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fe98a03c53
Коммит
96542c3678
|
@ -1,3 +1,11 @@
|
|||
Tue Jan 26 21:36:22 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* configure.in: test unsetenv returns a value.
|
||||
unsetenv is void in older BSDs (FreeBSD 6 and OpenBSD 4.5 at least).
|
||||
|
||||
* hash.c (ruby_setenv): don't use the result of unsetenv if unsetenv
|
||||
doesn't return a value.
|
||||
|
||||
Tue Jan 26 21:32:03 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/extconf.rb: suppress a warning.
|
||||
|
|
10
configure.in
10
configure.in
|
@ -1121,6 +1121,16 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot getcwd eacce
|
|||
mktime timegm gmtime_r clock_gettime gettimeofday\
|
||||
pread sendfile shutdown sigaltstack)
|
||||
|
||||
AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value,
|
||||
[AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
], [int v = unsetenv("foo");],
|
||||
rb_cv_unsetenv_return_value=yes,
|
||||
rb_cv_unsetenv_return_value=no)])
|
||||
if test "$rb_cv_unsetenv_return_value" = no; then
|
||||
AC_DEFINE(VOID_UNSETENV)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
|
||||
[AC_TRY_LINK([@%:@include <setjmp.h>
|
||||
jmp_buf jb; void t(v) int v; {__builtin_longjmp(jb, v);}],
|
||||
|
|
4
hash.c
4
hash.c
|
@ -2073,8 +2073,12 @@ ruby_setenv(const char *name, const char *value)
|
|||
if (setenv(name, value, 1))
|
||||
rb_sys_fail("setenv");
|
||||
} else {
|
||||
#ifdef VOID_UNSETENV
|
||||
unsetenv(name);
|
||||
#else
|
||||
if (unsetenv(name))
|
||||
rb_sys_fail("unsetenv");
|
||||
#endif
|
||||
}
|
||||
#elif defined __sun__
|
||||
size_t len;
|
||||
|
|
Загрузка…
Ссылка в новой задаче