File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -485,10 +485,18 @@ PHP_MSHUTDOWN_FUNCTION(pcntl)
485485PHP_RSHUTDOWN_FUNCTION (pcntl )
486486{
487487 struct php_pcntl_pending_signal * sig ;
488+ zend_long signo ;
489+ zval * handle ;
490+
491+ /* Reset all signals to their default disposition */
492+ ZEND_HASH_FOREACH_NUM_KEY_VAL (& PCNTL_G (php_signal_table ), signo , handle ) {
493+ if (Z_TYPE_P (handle ) != IS_LONG || Z_LVAL_P (handle ) != (zend_long )SIG_DFL ) {
494+ php_signal (signo , (Sigfunc * )(zend_long )SIG_DFL , 0 );
495+ }
496+ } ZEND_HASH_FOREACH_END ();
488497
489- /* FIXME: if a signal is delivered after this point, things will go pear shaped;
490- * need to remove signal handlers */
491498 zend_hash_destroy (& PCNTL_G (php_signal_table ));
499+
492500 while (PCNTL_G (head )) {
493501 sig = PCNTL_G (head );
494502 PCNTL_G (head ) = sig -> next ;
@@ -499,6 +507,7 @@ PHP_RSHUTDOWN_FUNCTION(pcntl)
499507 PCNTL_G (spares ) = sig -> next ;
500508 efree (sig );
501509 }
510+
502511 return SUCCESS ;
503512}
504513
You can’t perform that action at this time.
0 commit comments