develooper Front page | perl.perl5.porters | Postings from December 2008

Re: [PATCH] standardize save/restore of errno & vaxc$errno

Thread Previous | Thread Next
From:
Chip Salzenberg
Date:
December 5, 2008 15:47
Subject:
Re: [PATCH] standardize save/restore of errno & vaxc$errno
Message ID:
20081205234714.GL16081@tytlal.topaz.cx
On Fri, Dec 05, 2008 at 05:29:24PM -0600, Craig A. Berry wrote:
> On Fri, Dec 5, 2008 at 3:32 PM, Chip Salzenberg <chip@pobox.com> wrote:
> > @@ -2875,8 +2875,8 @@ Perl_my_pclose(pTHX_ PerlIO *ptr)
> >        return my_syspclose(ptr);
> >     }
> >  #endif
> > -    if ((close_failed = (PerlIO_close(ptr) == EOF)))
> > -       SAVE_ERRNO;
> > +    close_failed = (PerlIO_close(ptr) == EOF);
> > +    SAVE_ERRNO;
> 
> Is that line supposed to be
>     if (close_failed) SAVE_ERRNO;
> ?  Or do you now want to save errno regardless of whether the close failed?

The latter.  Gcc warns, erroneously, when the save is conditional.  It can't
figure out that the restore can only happen if the save already did.
-- 
Chip Salzenberg   twitter:chipsalz
"UTOPIA PLANITIA IS IN ORBIT is the new HAN SHOT FIRST" - Crisper Than Thou

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About