diff options
-rw-r--r-- | gv.c | 2 | ||||
-rw-r--r-- | pp_sys.c | 3 | ||||
-rw-r--r-- | t/op/coresubs.t | 10 |
3 files changed, 12 insertions, 3 deletions
@@ -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: @@ -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 '; |