In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/c6757210fa44035178e0a2501e1022995a42b70d?hp=423174046424f87a68e7227cd8015f1926fede2d>
- Log ----------------------------------------------------------------- commit c6757210fa44035178e0a2501e1022995a42b70d Author: Jarkko Hietaniemi <[email protected]> Date: Sun Jun 14 12:53:22 2009 -0400 The attached patch to perlio.c fixes the problem of errno getting set. While I am firmly in the school of "do not look at $! except immediately after a failure", I also agree that spuriously setting it is messy. But there is just no way of knowing where your errno might have been. The problem was that PerlIO_fast_gets() (and other nearby similar capability-checking PerlIO routines) set the errno (and it was being called a lot, from sv_gets()). I think setting the errno here was a mistake: checking for "can has FOO" should not set external state, such as the errno. The patch removes that errno trashing from all those routines. ----------------------------------------------------------------------- Summary of changes: perlio.c | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-) diff --git a/perlio.c b/perlio.c index 10a32c1..4fe4fa7 100644 --- a/perlio.c +++ b/perlio.c @@ -1773,10 +1773,7 @@ PerlIO_has_base(PerlIO *f) if (tab) return (tab->Get_base != NULL); - SETERRNO(EINVAL, LIB_INVARG); } - else - SETERRNO(EBADF, SS_IVCHAN); return 0; } @@ -1790,11 +1787,8 @@ PerlIO_fast_gets(PerlIO *f) if (tab) return (tab->Set_ptrcnt != NULL); - SETERRNO(EINVAL, LIB_INVARG); } } - else - SETERRNO(EBADF, SS_IVCHAN); return 0; } @@ -1807,10 +1801,7 @@ PerlIO_has_cntptr(PerlIO *f) if (tab) return (tab->Get_ptr != NULL && tab->Get_cnt != NULL); - SETERRNO(EINVAL, LIB_INVARG); } - else - SETERRNO(EBADF, SS_IVCHAN); return 0; } @@ -1823,10 +1814,7 @@ PerlIO_canset_cnt(PerlIO *f) if (tab) return (tab->Set_ptrcnt != NULL); - SETERRNO(EINVAL, LIB_INVARG); } - else - SETERRNO(EBADF, SS_IVCHAN); return 0; } -- Perl5 Master Repository
