1
1

Check for the presence of setenv. If it is present, then use it in opal_setenv when setting values in the environ

Этот коммит содержится в:
Ralph Castain 2014-11-04 16:11:15 -08:00
родитель 07263889d5
Коммит 907b4606c5
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -867,7 +867,7 @@ OPAL_SEARCH_LIBS_CORE([dirname], [gen])
# Darwin doesn't need -lm, as it's a symlink to libSystem.dylib
OPAL_SEARCH_LIBS_CORE([ceil], [m])
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid])
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv])
# Sanity check: ensure that we got at least one of statfs or statvfs.
if test $ac_cv_func_statfs = no -a $ac_cv_func_statvfs = no; then

Просмотреть файл

@ -11,7 +11,8 @@
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
* reserved.
* reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -123,10 +124,15 @@ int opal_setenv(const char *name, const char *value, bool overwrite,
if( *env == environ ) {
/* THIS IS POTENTIALLY A MEMORY LEAK! But I am doing it
because so that we don't violate the law of least
astonishmet for OPAL developers (i.e., those that don't
astonishment for OPAL developers (i.e., those that don't
check the return code of opal_setenv() and notice that we
returned an error if you passed in the real environ) */
#if defined (HAVE_SETENV)
setenv(name, value, overwrite);
free(newvalue);
#else
putenv(newvalue);
#endif
return OPAL_SUCCESS;
}