summaryrefslogtreecommitdiff
path: root/vms/vms.c
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2013-03-24 20:39:38 -0500
committerCraig A. Berry <craigberry@mac.com>2013-03-24 20:39:38 -0500
commita1027d22c953600ee4d8f92e053e9f49029ed34f (patch)
tree5aa567ad29d5f293ef976ca1ae81e2191878406d /vms/vms.c
parent49e623dcba6e8f377bd00fd36832fc84b540a538 (diff)
downloadperl-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/vms.c')
-rw-r--r--vms/vms.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vms/vms.c b/vms/vms.c
index 58de70d40a..8cb324505a 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -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;