Skip to content

Commit 637e8e1

Browse files
author
Sascha Schumann
committed
There might be more systems which do not support chroot, so we check
for the existence of it. Additionally, if chroot is not supported, the warn_not_available function is invoked now.
1 parent c239da7 commit 637e8e1

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

configure.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ dnl Checks for library functions.
358358
AC_FUNC_VPRINTF
359359
AC_CHECK_FUNCS(
360360
asctime_r \
361+
chroot \
361362
crypt \
362363
ctime_r \
363364
cuserid \

ext/standard/basic_functions.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,10 @@ function_entry basic_functions[] = {
465465
PHP_FE(opendir, NULL)
466466
PHP_FE(closedir, NULL)
467467
PHP_FE(chdir, NULL)
468-
#if !defined(ZEND_WIN32)&&!defined(ZTS)
468+
#if defined(HAVE_CHROOT) && !defined(ZTS)
469469
PHP_FE(chroot, NULL)
470+
#else
471+
PHP_FALIAS(chroot, warn_not_available, NULL)
470472
#endif
471473
PHP_FE(getcwd, NULL)
472474
PHP_FE(rewinddir, NULL)

ext/standard/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ PHP_FUNCTION(closedir)
223223

224224
/* }}} */
225225

226-
#if !defined(ZEND_WIN32)&&!defined(ZTS)
226+
#if defined(HAVE_CHROOT) && !defined(ZTS)
227227
/* {{{ proto int chroot(string directory)
228228
Change root directory */
229229

ext/standard/php_dir.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ PHP_RINIT_FUNCTION(dir);
2828
PHP_FUNCTION(opendir);
2929
PHP_FUNCTION(closedir);
3030
PHP_FUNCTION(chdir);
31-
#if !defined(ZEND_WIN32)&&!defined(ZTS)
31+
#if defined(HAVE_CHROOT) && !defined(ZTS)
3232
PHP_FUNCTION(chroot);
3333
#endif
3434
PHP_FUNCTION(getcwd);

0 commit comments

Comments
 (0)