This commit allows &CORE::setpgrp to be called through references and
via ampersand syntax. pp_setpgrp is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell setpgrp how many arguments it’s
actually getting. See commit
0163043a for details.
case KEY_lstat:
case KEY_pop:
case KEY_push:
- case KEY_setpgrp: case KEY_shift:
+ case KEY_shift:
case KEY_splice:
case KEY_stat:
case KEY_system:
dVAR; dSP; dTARGET;
Pid_t pgrp;
Pid_t pid;
- if (MAXARG == 1) pgrp = 0, pid = TOPi;
- else if (MAXARG < 2) {
- pgrp = 0;
+ pgrp = MAXARG == 2 && (TOPs||POPs) ? POPi : 0;
+ if (MAXARG > 0) pid = TOPs && TOPi;
+ else {
pid = 0;
XPUSHi(-1);
}
- else {
- pgrp = POPi;
- pid = TOPi;
- }
TAINT_PROPER("setpgrp");
#ifdef BSD_SETPGRP
test_proto 'send';
test_proto "set$_" for qw '
- grent hostent netent priority protoent pwent servent sockopt
+ grent hostent netent
+';
+
+test_proto 'setpgrp';
+$tests +=2;
+eval { &mysetpgrp( 0) };
+pass "&setpgrp with one argument";
+eval { &mysetpgrp };
+pass "&setpgrp with no arguments";
+
+test_proto "set$_" for qw '
+ priority protoent pwent servent sockopt
';
test_proto "shm$_" for qw "ctl get read write";