summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorAaron Crane <arc@cpan.org>2014-10-20 15:22:52 +0100
committerAaron Crane <arc@cpan.org>2014-10-20 21:43:38 +0100
commitfa367bcbf78381959666f443b5f1d9da7870f943 (patch)
treef6875abf71ea6bb896a8ece94a5447226cb4ec90 /pp_sys.c
parent6aa683079638ed0b1923473b64317a0ef3a99849 (diff)
downloadperl-fa367bcbf78381959666f443b5f1d9da7870f943.tar.gz
Fix stack-management bug when semctl encounters errors
The success cases in pp_semctl both push a single value to the stack, but the error case merely set the topmost stack value to undef. The fix is to push an undef. This bug manifests most obviously as an "uninitialized value in list slice" warning when doing something like `my $test = (semctl -1,0,0,0)[0]`; that was reported out-of-band to rjbs.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 95a709b0e4..16c2d60ba0 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4753,7 +4753,7 @@ PP(pp_semctl)
const int anum = do_ipcctl(PL_op->op_type, MARK, SP);
SP = MARK;
if (anum == -1)
- RETSETUNDEF;
+ RETPUSHUNDEF;
if (anum != 0) {
PUSHi(anum);
}