Skip to content

ext/pcntl pcntl_signal_get_handler update. #13902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions ext/pcntl/pcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,17 @@ PHP_FUNCTION(pcntl_signal_get_handler)
Z_PARAM_LONG(signo)
ZEND_PARSE_PARAMETERS_END();

if (signo < 1 || signo > 32) {
zend_argument_value_error(1, "must be between 1 and 32");
// note: max signal on mac is SIGUSR2 (31), no real time signals.
int sigmax = NSIG - 1;
#if defined(SIGRTMAX)
// oddily enough, NSIG on freebsd reports only 32 whereas SIGRTMIN starts at 65.
if (sigmax < SIGRTMAX) {
sigmax = SIGRTMAX;
}
#endif

if (signo < 1 || signo > sigmax) {
zend_argument_value_error(1, "must be between 1 and %d", sigmax);
RETURN_THROWS();
}

Expand Down