mirror of
https://github.com/php/php-src.git
synced 2024-12-03 06:44:07 +08:00
Improve privilege check in pcntl_setpriority() test
We need CAP_SYS_NICE privileges, which might not be available just because we're running as root (Docker...)
This commit is contained in:
parent
fcfa0a46c3
commit
34e7d78df7
@ -11,8 +11,8 @@ if (!extension_loaded('pcntl')) {
|
||||
if (!function_exists('pcntl_setpriority')) {
|
||||
die('skip pcntl_setpriority doesn\'t exist');
|
||||
}
|
||||
if (!function_exists('posix_getuid') || posix_getuid() !== 0) {
|
||||
die('skip this functions needs to run with superuser');
|
||||
if (@pcntl_setpriority(-5) === false && pcntl_get_last_error() == PCNTL_EACCES) {
|
||||
die('skip this function needs to run with CAP_SYS_NICE privileges');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
|
Loading…
Reference in New Issue
Block a user