This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The attached patch to perlio.c fixes the problem of errno getting set.
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 14 Jun 2009 16:53:22 +0000 (12:53 -0400)
committerCraig A. Berry <craigberry@mac.com>
Mon, 15 Jun 2009 00:02:15 +0000 (19:02 -0500)
commitc6757210fa44035178e0a2501e1022995a42b70d
treed4b7449976d9238af4f1b6ab2619a03ba96e5800
parent423174046424f87a68e7227cd8015f1926fede2d
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.
perlio.c