This commit allows &CORE::sysopen to be called through references and
via ampersand syntax. pp_sysopen 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 sysopen how many arguments it’s
actually getting. See commit
0163043a for details.
case KEY_setpgrp: case KEY_shift:
case KEY_splice:
case KEY_stat:
- case KEY_sysopen:
case KEY_system:
case KEY_tell: case KEY_tie: case KEY_tied:
case KEY_truncate: case KEY_umask: case KEY_unlink:
{
dVAR;
dSP;
- const int perm = (MAXARG > 3) ? POPi : 0666;
+ const int perm = (MAXARG > 3 && (TOPs || POPs)) ? POPi : 0666;
const int mode = POPi;
SV * const sv = POPs;
GV * const gv = MUTABLE_GV(POPs);
test_proto 'symlink';
test_proto 'syscall';
+
+test_proto 'sysopen';
+$tests +=2;
+{
+ &mysysopen(my $fh, 'test.pl', 0);
+ pass '&sysopen does not crash with 3 args';
+ ok $fh, 'sysopen autovivifies';
+}
+
test_proto 'sysread';
test_proto 'sysseek';
test_proto 'syswrite';