In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/5a04397369a036f9a5c8e299f1a215c2fac4b6c8?hp=e1a7ec8d453649a65aea34af90c3042a5137191e>
- Log ----------------------------------------------------------------- commit 5a04397369a036f9a5c8e299f1a215c2fac4b6c8 Author: Craig A. Berry <[email protected]> Date: Sun Mar 24 20:49:38 2013 -0500 Copyright update for vms/vms.c. Happy 20th Anniversary, Charles. M vms/vms.c commit a1027d22c953600ee4d8f92e053e9f49029ed34f Author: Craig A. Berry <[email protected]> Date: Sun Mar 24 20:39:38 2013 -0500 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. M t/io/errno.t M vms/vms.c commit 49e623dcba6e8f377bd00fd36832fc84b540a538 Author: Craig A. Berry <[email protected]> Date: Sun Mar 24 20:31:59 2013 -0500 Revert "Restore errno after VMS hack in S_sv_gets_read_record." This reverts commit d46f021e36854e800770363f716e7b4a846102ef. This can be done more universally (and from the point of view of sv.c, less obtrusively) in Perl_flex_fstat in vms/vms.c. M sv.c ----------------------------------------------------------------------- Summary of changes: sv.c | 3 --- t/io/errno.t | 2 -- vms/vms.c | 7 +++---- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sv.c b/sv.c index 4ed4349..3f68d9c 100644 --- a/sv.c +++ b/sv.c @@ -7674,7 +7674,6 @@ S_sv_gets_read_record(pTHX_ SV *const sv, PerlIO *const fp, I32 append) #include <rms.h> int fd; Stat_t st; - dSAVE_ERRNO; /* With a true, record-oriented file on VMS, we need to use read directly * to ensure that we respect RMS record boundaries. The user is responsible @@ -7689,8 +7688,6 @@ S_sv_gets_read_record(pTHX_ SV *const sv, PerlIO *const fp, I32 append) || st.st_fab_rfm == FAB$C_VFC || st.st_fab_rfm == FAB$C_FIX)) { - /* fstat does the equivalent of SETERRNO(EVMSERR, RMS$_IOP) on PPFs. */ - RESTORE_ERRNO; bytesread = PerlLIO_read(fd, buffer, recsize); } else /* in-memory file from PerlIO::Scalar diff --git a/t/io/errno.t b/t/io/errno.t index dadc4e0..e9a6c09 100644 --- a/t/io/errno.t +++ b/t/io/errno.t @@ -34,8 +34,6 @@ SKIP: for my $rs_code ('', '$/=undef', '$/=\2', '$/=\1024') { TODO: { - local $::TODO = "We get RMS\$_IOP at EOF on VMS when \$/ is undef" - if $^O eq 'VMS' && $rs_code eq '$/=undef'; is( runperl( prog => "$rs_code; $test_prog", stdin => $test_in, stderr => 1), $test_in, diff --git a/vms/vms.c b/vms/vms.c index 58de70d..1c93728 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -2,13 +2,10 @@ * * VMS-specific routines for perl5 * - * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - * 2002, 2003, 2004, 2005, 2006, 2007 by Charles Bailey and others. + * Copyright (C) 1993-2013 by Charles Bailey and others. * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. - * - * Please see Changes*.* or the Perl Repository Browser for revision history. */ /* @@ -12068,6 +12065,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 +12101,7 @@ Perl_flex_fstat(pTHX_ int fd, Stat_t *statbufp) statbufp->st_ctime = _toloc(statbufp->st_ctime); } # endif + RESTORE_ERRNO; return 0; } return -1; -- Perl5 Master Repository
