Skip to content

Commit 8fd79d3

Browse files
committed
Add privilege check in pcntl_unshare test
Privileges for CLONE_NEWPID were not checked.
1 parent 3b86be2 commit 8fd79d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ext/pcntl/tests/pcntl_unshare_02.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ if (!defined("CLONE_NEWPID")) die("skip flag unavailable");
99
if (getenv("SKIP_ASAN")) die("skip asan chokes on this");
1010
if (posix_getuid() !== 0 &&
1111
(!defined("CLONE_NEWUSER") ||
12-
(pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
13-
die("skip Insufficient previleges to run test");
12+
(@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
13+
die("skip Insufficient privileges for CLONE_NEWUSER");
14+
}
15+
if (@pcntl_unshare(CLONE_NEWPID) == false && pcntl_get_last_error() == PCNTL_EPERM) {
16+
die("skip Insufficient privileges for CLONE_NEWPID");
1417
}
1518

1619
--FILE--

0 commit comments

Comments
 (0)