Issue #13415: Test in configure if unsetenv() has a return value or not.

This commit is contained in:
Charles-François Natali 2011-11-27 12:41:06 +01:00
parent 6d47db31f0
commit 6613c18ea2
4 changed files with 333 additions and 310 deletions

View File

@ -6185,18 +6185,24 @@ posix_unsetenv(PyObject *self, PyObject *args)
{ {
PyObject *os1; PyObject *os1;
char *s1; char *s1;
#ifndef HAVE_BROKEN_UNSETENV
int err; int err;
#endif
if (!PyArg_ParseTuple(args, "O&:unsetenv", if (!PyArg_ParseTuple(args, "O&:unsetenv",
PyUnicode_FSConverter, &os1)) PyUnicode_FSConverter, &os1))
return NULL; return NULL;
s1 = PyBytes_AsString(os1); s1 = PyBytes_AsString(os1);
#ifdef HAVE_BROKEN_UNSETENV
unsetenv(s1);
#else
err = unsetenv(s1); err = unsetenv(s1);
if (err) { if (err) {
Py_DECREF(os1); Py_DECREF(os1);
return posix_error(); return posix_error();
} }
#endif
/* Remove the key from posix_putenv_garbage; /* Remove the key from posix_putenv_garbage;
* this will cause it to be collected. This has to * this will cause it to be collected. This has to

625
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2696,6 +2696,15 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
[AC_MSG_RESULT(no) [AC_MSG_RESULT(no)
]) ])
AC_MSG_CHECKING(for broken unsetenv)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
]], [[int res = unsetenv("DUMMY")]])],
[AC_MSG_RESULT(no)],
[AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
AC_MSG_RESULT(yes)
])
dnl check for true dnl check for true
AC_CHECK_PROGS(TRUE, true, /bin/true) AC_CHECK_PROGS(TRUE, true, /bin/true)

View File

@ -98,6 +98,9 @@
/* define to 1 if your sem_getvalue is broken. */ /* define to 1 if your sem_getvalue is broken. */
#undef HAVE_BROKEN_SEM_GETVALUE #undef HAVE_BROKEN_SEM_GETVALUE
/* Define if `unsetenv` does not return an int. */
#undef HAVE_BROKEN_UNSETENV
/* Define this if you have the type _Bool. */ /* Define this if you have the type _Bool. */
#undef HAVE_C99_BOOL #undef HAVE_C99_BOOL