[php-src] master: ext/pcntl: pcntl affinity improves EINVAL handling in both cases. (#13907)
| From: | David CARLIER via GitHub | Date: | Sun, 07 Apr 2024 15:43:41 +0000 |
| Subject: | [php-src] master: ext/pcntl: pcntl affinity improves EINVAL handling in both cases. (#13907) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-127967@lists.php.net to get a copy of this message | ||
Author: David CARLIER (devnexen)
Committer: GitHub (web-flow)
Pusher: devnexen
Date: 2024-04-07T16:43:36+01:00
Commit: https://github.com/php/php-src/commit/dd2ffaab2c3a38f82afdf5564c008ee48aa53bed
Raw diff: https://github.com/php/php-src/commit/dd2ffaab2c3a38f82afdf5564c008ee48aa53bed.diff
ext/pcntl: pcntl affinity improves EINVAL handling in both cases. (#13907)
also disable tests on travis.
Changed paths:
M ext/pcntl/pcntl.c
M ext/pcntl/tests/pcntl_cpuaffinity.phpt
Diff:
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 891619afc60a..69b3b1f19acd 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1516,6 +1516,9 @@ PHP_FUNCTION(pcntl_getcpuaffinity)
case EPERM:
php_error_docref(NULL, E_WARNING, "Calling process not having the proper
privileges");
break;
+ case EINVAL:
+ zend_value_error("invalid cpu affinity mask size");
+ RETURN_THROWS();
default:
php_error_docref(NULL, E_WARNING, "Error %d", errno);
}
@@ -1597,6 +1600,9 @@ PHP_FUNCTION(pcntl_setcpuaffinity)
case EPERM:
php_error_docref(NULL, E_WARNING, "Calling process not having the proper
privileges");
break;
+ case EINVAL:
+ zend_argument_value_error(2, "invalid cpu affinity mask size or unmapped cpu id(s)");
+ RETURN_THROWS();
default:
php_error_docref(NULL, E_WARNING, "Error %d", errno);
}
diff --git a/ext/pcntl/tests/pcntl_cpuaffinity.phpt b/ext/pcntl/tests/pcntl_cpuaffinity.phpt
index 6dc3399e1611..caeb27d2759c 100644
--- a/ext/pcntl/tests/pcntl_cpuaffinity.phpt
+++ b/ext/pcntl/tests/pcntl_cpuaffinity.phpt
@@ -5,6 +5,7 @@ pcntl
--SKIPIF--
<?php
if (!function_exists("pcntl_setcpuaffinity")) die("skip pcntl_setcpuaffinity is not
available");
+if (getenv('TRAVIS')) die('skip Currently fails on Travis');
?>
--FILE--
<?php