]> granicus.if.org Git - php/commitdiff
use php_strtok_r() rather than strsep()
authorHannes Magnusson <bjori@php.net>
Thu, 10 May 2007 19:48:30 +0000 (19:48 +0000)
committerHannes Magnusson <bjori@php.net>
Thu, 10 May 2007 19:48:30 +0000 (19:48 +0000)
# Fixes build on, for instance, solaris

main/php_ini.c

index ae39d81d5ba55796857c35ad2e7c0d9bf0073bc9..aa9a96ceeb6fc8d2895ddb7e5f23087b944c69f0 100644 (file)
@@ -359,13 +359,16 @@ int php_init_config(TSRMLS_D)
 
                                if ((path = getenv("PATH")) != NULL) {
                                        char *search_dir, search_path[MAXPATHLEN];
+                                       char *last;
 
-                                       while ((search_dir = strsep(&path, ":")) != NULL) {
+                                       search_dir = php_strtok_r(path, ":", &last);
+                                       while (search_dir) {
                                                snprintf(search_path, MAXPATHLEN, "%s/%s", search_dir, sapi_module.executable_location);
                                                if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK)) {
                                                        found = 1;
                                                        break;
                                                }
+                                               search_dir = php_strtok_r(NULL, ":", &last);
                                        }
                                }
                                if (!found) {