com php-src: Improve privilege check in pcntl_setpriority( ) test: ext/pcntl/tests/pcntl_setpriority_basic.p hpt

From: Date: Wed, 05 Aug 2020 10:09:10 +0000
Subject: com php-src: Improve privilege check in pcntl_setpriority( ) test: ext/pcntl/tests/pcntl_setpriority_basic.p hpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-112569@lists.php.net to get a copy of this message
Commit: 34e7d78df73935477b5d603f3aa579389f3bef33 Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 5 Aug 2020 09:58:34 +0200 Parents: fcfa0a46c325a29383881eb22439f2152c9506f6 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=34e7d78df73935477b5d603f3aa579389f3bef33 Log: 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...) Changed paths: M ext/pcntl/tests/pcntl_setpriority_basic.phpt Diff: diff --git a/ext/pcntl/tests/pcntl_setpriority_basic.phpt b/ext/pcntl/tests/pcntl_setpriority_basic.phpt index 235b0ec9ce..0c92245e1e 100644 --- a/ext/pcntl/tests/pcntl_setpriority_basic.phpt +++ b/ext/pcntl/tests/pcntl_setpriority_basic.phpt @@ -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--

« previous php.cvs (#112569) next »