diff options
author | Patrick Allaert <pa@ez.no> | 2013-07-09 15:05:10 +0200 |
---|---|---|
committer | Patrick Allaert <pa@ez.no> | 2013-07-09 15:05:10 +0200 |
commit | b980e4fedc945dd0a45d73349716f6ab18a97635 (patch) | |
tree | a3d459efc65654cbd5db0472975ada3cf7c05929 /main | |
parent | 3cdd09a76eb21789bb10d02581b21fc9403e39a1 (diff) | |
download | php-git-b980e4fedc945dd0a45d73349716f6ab18a97635.tar.gz |
Fixed #65225: PHP_BINARY incorrectly set
Diffstat (limited to 'main')
-rw-r--r-- | main/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main/main.c b/main/main.c index de794ace99..d11ef84b34 100644 --- a/main/main.c +++ b/main/main.c @@ -114,6 +114,10 @@ #endif /* }}} */ +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif + PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions; #ifndef ZTS @@ -275,13 +279,14 @@ static void php_binary_init(TSRMLS_D) if ((envpath = getenv("PATH")) != NULL) { char *search_dir, search_path[MAXPATHLEN]; char *last = NULL; + struct stat s; path = estrdup(envpath); 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)) { + if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK) && VCWD_STAT(binary_location, &s) == 0 && S_ISREG(s.st_mode)) { found = 1; break; } |