summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/doio.c b/doio.c
index f624dcaef3..c7c6455dcd 100644
--- a/doio.c
+++ b/doio.c
@@ -366,8 +366,12 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe
PerlIO_clearerr(fp);
}
#if defined(HAS_FCNTL) && defined(F_SETFD)
- fd = PerlIO_fileno(fp);
- fcntl(fd,F_SETFD,fd > PL_maxsysfd);
+ {
+ int save_errno = errno;
+ fd = PerlIO_fileno(fp);
+ fcntl(fd,F_SETFD,fd > PL_maxsysfd); /* can change errno */
+ errno = save_errno;
+ }
#endif
IoIFP(io) = fp;
if (writing) {