File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7841,19 +7841,24 @@ static PyObject *
78417841posix_unsetenv (PyObject * self , PyObject * args )
78427842{
78437843 PyObject * name ;
7844+ #ifndef HAVE_BROKEN_UNSETENV
78447845 int err ;
7846+ #endif
78457847
78467848 if (!PyArg_ParseTuple (args , "O&:unsetenv" ,
78477849
78487850 PyUnicode_FSConverter , & name ))
78497851 return NULL ;
78507852
7851-
7853+ #ifdef HAVE_BROKEN_UNSETENV
7854+ unsetenv (PyBytes_AS_STRING (name ));
7855+ #else
78527856 err = unsetenv (PyBytes_AS_STRING (name ));
78537857 if (err ) {
78547858 Py_DECREF (name );
78557859 return posix_error ();
78567860 }
7861+ #endif
78577862
78587863 /* Remove the key from posix_putenv_garbage;
78597864 * this will cause it to be collected. This has to
Original file line number Diff line number Diff line change @@ -9812,6 +9812,34 @@ $as_echo "no" >&6; }
98129812fi
98139813rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
98149814
9815+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for broken unsetenv" >&5
9816+ $as_echo_n " checking for broken unsetenv... " >&6 ; }
9817+ cat confdefs.h - << _ACEOF >conftest.$ac_ext
9818+ /* end confdefs.h. */
9819+
9820+ #include <stdlib.h>
9821+
9822+ int
9823+ main ()
9824+ {
9825+ int res = unsetenv("DUMMY")
9826+ ;
9827+ return 0;
9828+ }
9829+ _ACEOF
9830+ if ac_fn_c_try_compile " $LINENO " ; then :
9831+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
9832+ $as_echo " no" >&6 ; }
9833+ else
9834+
9835+ $as_echo " #define HAVE_BROKEN_UNSETENV 1" >> confdefs.h
9836+
9837+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: yes" >&5
9838+ $as_echo " yes" >&6 ; }
9839+
9840+ fi
9841+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9842+
98159843for ac_prog in true
98169844do
98179845 # Extract the first word of "$ac_prog", so it can be a program name with args.
Original file line number Diff line number Diff line change @@ -2688,6 +2688,15 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
26882688 [AC_MSG_RESULT(no)
26892689])
26902690
2691+ AC_MSG_CHECKING(for broken unsetenv)
2692+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2693+ #include <stdlib.h>
2694+ ]], [[int res = unsetenv("DUMMY")]])],
2695+ [AC_MSG_RESULT(no)],
2696+ [AC_DEFINE(HAVE_BROKEN_UNSETENV, 1, Define if `unsetenv` does not return an int.)
2697+ AC_MSG_RESULT(yes)
2698+ ])
2699+
26912700dnl check for true
26922701AC_CHECK_PROGS(TRUE, true, /bin/true)
26932702
Original file line number Diff line number Diff line change 9595/* define to 1 if your sem_getvalue is broken. */
9696#undef HAVE_BROKEN_SEM_GETVALUE
9797
98+ /* Define if `unsetenv` does not return an int. */
99+ #undef HAVE_BROKEN_UNSETENV
100+
98101/* Define this if you have the type _Bool. */
99102#undef HAVE_C99_BOOL
100103
You can’t perform that action at this time.
0 commit comments