diff options
author | 2010-03-21 12:32:51 +0000 | |
---|---|---|
committer | 2010-03-21 12:32:51 +0000 | |
commit | 216502ddea2127a385be2b14ee46d504540b92c5 (patch) | |
tree | b95866677166f59861eb2dd7f61711b142b75362 | |
parent | Set a+rx permissions on /usr/bin/python-config to work around systems with br... (diff) | |
download | eselect-python-216502ddea2127a385be2b14ee46d504540b92c5.tar.gz eselect-python-216502ddea2127a385be2b14ee46d504540b92c5.tar.bz2 eselect-python-216502ddea2127a385be2b14ee46d504540b92c5.zip |
Fix building on systems without strtok_r() (bug #299152).
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | python-wrapper.c | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 46291cc..9f9d305 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,8 @@ MKDIR="${MKDIR:-${INSTALL} -d}" AC_USE_SYSTEM_EXTENSIONS # setenv() was introduced in POSIX.1-2008. -AC_CHECK_FUNCS([setenv]) +# strtok_r() was introduced in POSIX.1-2001. +AC_CHECK_FUNCS([setenv strtok_r]) # strndup() was introduced in POSIX.1-2008 and is also an implicitly declared built-in function in GCC. AC_MSG_CHECKING([for strndup]) diff --git a/python-wrapper.c b/python-wrapper.c index ecc26bc..0a10bc9 100644 --- a/python-wrapper.c +++ b/python-wrapper.c @@ -50,8 +50,12 @@ const char* find_path(const char* exe) PATH = ":/bin:/usr/bin"; } char* path = strdup(PATH); +#ifdef HAVE_STRTOK_R char* state = NULL; const char* token = strtok_r(path, ":", &state); +#else + const char* token = strtok(path, ":"); +#endif while (token) { /* If an element of PATH is empty ("::"), then it is "." */ @@ -65,7 +69,11 @@ const char* find_path(const char* exe) { return token; } +#ifdef HAVE_STRTOK_R token = strtok_r(NULL, ":", &state); +#else + token = strtok(NULL, ":"); +#endif } return NULL; } |