summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-06-15 11:43:42 +0100
committerDavid Mitchell <davem@iabyn.com>2017-06-22 13:37:51 +0100
commit78e69e607cdc9eed625a2bb8a98fbeadf0365bad (patch)
tree7352c8c6ed9d6e317d2a5293219b4f21d80f9659 /pp_sys.c
parentb7effc98210707765c69fb0a0b9b695d5e7483ce (diff)
downloadperl-78e69e607cdc9eed625a2bb8a98fbeadf0365bad.tar.gz
recv: reset stack when returning undef
When recv() detects an error, it returns undef: but it was failing to pop its args off the stack first. So in list context it returned both its original args and undef. It was also then not extending the stack to push the undef. After this commit it resets SP to the base of its args list first, like the other ops already do which share the Perl_pp_systread() function body.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index c6f9726079..65900faf5a 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1760,7 +1760,7 @@ PP(pp_sysread)
char namebuf[MAXPATHLEN];
if (fd < 0) {
SETERRNO(EBADF,SS_IVCHAN);
- RETPUSHUNDEF;
+ goto say_undef;
}
#if (defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)) || defined(__QNXNTO__)
bufsize = sizeof (struct sockaddr_in);
@@ -1776,7 +1776,7 @@ PP(pp_sysread)
count = PerlSock_recvfrom(fd, buffer, length, offset,
(struct sockaddr *)namebuf, &bufsize);
if (count < 0)
- RETPUSHUNDEF;
+ goto say_undef;
/* MSG_TRUNC can give oversized count; quietly lose it */
if (count > length)
count = length;