summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gv.c2
-rw-r--r--pp_sys.c3
-rw-r--r--t/op/coresubs.t10
3 files changed, 12 insertions, 3 deletions
diff --git a/gv.c b/gv.c
index 6f1756c96c..e22942523a 100644
--- a/gv.c
+++ b/gv.c
@@ -1354,7 +1354,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
case KEY_chdir:
case KEY_chomp: case KEY_chop:
case KEY_each: case KEY_eof: case KEY_exec:
- case KEY_getpgrp: case KEY_gmtime:
+ case KEY_gmtime:
case KEY_index: case KEY_keys:
case KEY_localtime: case KEY_lock: case KEY_lstat:
case KEY_mkdir: case KEY_open: case KEY_pop:
diff --git a/pp_sys.c b/pp_sys.c
index 704e581a8f..231388f21a 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4319,7 +4319,8 @@ PP(pp_getpgrp)
#ifdef HAS_GETPGRP
dVAR; dSP; dTARGET;
Pid_t pgrp;
- const Pid_t pid = (MAXARG < 1) ? 0 : SvIVx(POPs);
+ const Pid_t pid =
+ (MAXARG < 1) ? 0 : TOPs ? SvIVx(POPs) : ((void)POPs, 0);
#ifdef BSD_GETPGRP
pgrp = (I32)BSD_GETPGRP(pid);
diff --git a/t/op/coresubs.t b/t/op/coresubs.t
index c0f59661ec..3339f4f410 100644
--- a/t/op/coresubs.t
+++ b/t/op/coresubs.t
@@ -358,7 +358,15 @@ test_proto 'getc';
test_proto "get$_" for qw '
grent grgid grnam hostbyaddr hostbyname hostent login netbyaddr netbyname
- netent peername ppid priority protobyname protobynumber protoent
+ netent peername
+';
+
+test_proto 'getpgrp';
+eval {&mygetpgrp()};
+pass '&getpgrp with no args does not crash'; $tests++;
+
+test_proto "get$_" for qw '
+ ppid priority protobyname protobynumber protoent
pwent pwnam pwuid servbyname servbyport servent sockname sockopt
';