diff options
author | Tony Cook <tony@develop-help.com> | 2016-06-16 14:08:18 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2016-06-16 14:08:18 +1000 |
commit | 3f6b66c14467c0f8c7459e32c576618155ca89f3 (patch) | |
tree | fe33399c8f7adb14ff1dcc64e8c38b805ee1f1b7 /pp_sys.c | |
parent | bc4a5ad569b742afe08bedbf713cb595cef4e09e (diff) | |
download | perl-3f6b66c14467c0f8c7459e32c576618155ca89f3.tar.gz |
(perl #128316) preserve errno from failed system calls
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2497,7 +2497,6 @@ PP(pp_socket) TAINT_PROPER("socket"); fd = PerlSock_socket(domain, type, protocol); if (fd < 0) { - SETERRNO(EBADF,RMS_IFI); RETPUSHUNDEF; } IoIFP(io) = PerlIO_fdopen(fd, "r"SOCKET_OPEN_MODE); /* stdio gets confused about sockets */ @@ -3531,8 +3530,9 @@ PP(pp_fttext) } PL_laststatval = PerlLIO_fstat(fd, &PL_statcache); if (PL_laststatval < 0) { + dSAVE_ERRNO; (void)PerlIO_close(fp); - SETERRNO(EBADF,RMS_IFI); + RESTORE_ERRNO; FT_RETURNUNDEF; } PerlIO_binmode(aTHX_ fp, '<', O_BINARY, NULL); |