diff options
author | Craig A. Berry <craigberry@mac.com> | 2013-03-24 20:39:38 -0500 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2013-03-24 20:39:38 -0500 |
commit | a1027d22c953600ee4d8f92e053e9f49029ed34f (patch) | |
tree | 5aa567ad29d5f293ef976ca1ae81e2191878406d /vms | |
parent | 49e623dcba6e8f377bd00fd36832fc84b540a538 (diff) | |
download | perl-a1027d22c953600ee4d8f92e053e9f49029ed34f.tar.gz |
Make vms.c's Perl_flex_fstat preserve errno on success.
The CRTL's fstat() sets errno to EVMSERR and vaxc$errno to RMS$_IOP
when called on a proccess-permanent file (i.e., stdin, stdout, or
stderr). That error generally means a rewind operation on a file
that cannot be rewound. It's odd that fstat is doing such a thing,
but we can at least protect ourselves from the effects of it by
saving errno and restoring it on a successful call.
This cures a couple of test failures and TODOs in t/io/errno.t.
Diffstat (limited to 'vms')
-rw-r--r-- | vms/vms.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -12068,6 +12068,7 @@ Perl_cando_by_name(pTHX_ I32 bit, bool effective, const char *fname) int Perl_flex_fstat(pTHX_ int fd, Stat_t *statbufp) { + dSAVE_ERRNO; /* fstat may set this even on success */ if (!fstat(fd, &statbufp->crtl_stat)) { char *cptr; char *vms_filename; @@ -12103,6 +12104,7 @@ Perl_flex_fstat(pTHX_ int fd, Stat_t *statbufp) statbufp->st_ctime = _toloc(statbufp->st_ctime); } # endif + RESTORE_ERRNO; return 0; } return -1; |