summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/perlio.c b/perlio.c
index a3ea344620..95c3b24fb7 100644
--- a/perlio.c
+++ b/perlio.c
@@ -3131,8 +3131,8 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
const int fd = fileno(stdio);
int invalidate = 0;
IV result = 0;
- int saveerr = 0;
int dupfd = -1;
+ dSAVEDERRNO;
#ifdef USE_ITHREADS
dVAR;
#endif
@@ -3166,7 +3166,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
fileno slot of the FILE *
*/
result = PerlIO_flush(f);
- saveerr = errno;
+ SAVE_ERRNO;
invalidate = PerlIOStdio_invalidate_fileno(aTHX_ stdio);
if (!invalidate) {
#ifdef USE_ITHREADS
@@ -3205,7 +3205,7 @@ PerlIOStdio_close(pTHX_ PerlIO *f)
errno may NOT be expected EBADF
*/
if (invalidate && result != 0) {
- errno = saveerr;
+ RESTORE_ERRNO;
result = 0;
}
#ifdef SOCKS5_VERSION_NAME
@@ -3367,9 +3367,9 @@ PerlIOStdio_flush(pTHX_ PerlIO *f)
/*
* Not writeable - sync by attempting a seek
*/
- const int err = errno;
+ dSAVE_ERRNO;
if (PerlSIO_fseek(stdio, (Off_t) 0, SEEK_CUR) != 0)
- errno = err;
+ RESTORE_ERRNO;
#endif
}
return 0;