perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Carmody <thefatp...@yahoo.co.uk>
Subject Re: mod_perl-2.0.8 + OWC
Date Mon, 22 Apr 2013 10:48:18 GMT
> 7. The compiler liked this initialised.
> > --- modperl_apr_perlio.c.orig   
> 2012-07-22 07:51:04.140625000 +1000
> > +++ modperl_apr_perlio.c    2013-03-25
> 08:58:30.187500000 +1100
> > @@ -547,7 +547,7 @@
> >  {
> >      MP_IO_TYPE *retval;
> >      char *mode;
> > -    int fd;
> > +    int fd = 0;
> >      apr_os_file_t os_file;
> >      apr_status_t rc;


No. The compiler didn't like that initialised, the compiler didn't like the use of it uninitialised,
which was here:

    if (!(retval = PerlIO_fdopen(os_file, mode))) { 
        PerlLIO_close(fd);
        Perl_croak(aTHX_ "fdopen failed!");
    } 

Where did 0 come from in your patch? Why not 42? Why not 666? Why is it so important to you
to close file descriptor 0 when that PerlIO_fdopen fails?

What you seem to have done is remove the useful warning to a potential bug. I.e. you've made
the situation worse.

I have never looked at the MP codebase before, but from very quick inspection, the correct
fix is to comment out the definition of fd and that use of it. I lie. The correct thing to
do is to delete the references to it, and the commented out code. Version control systems
are how you should keep the historical versions accessible, not comments.

Phil
-- 
()  ASCII ribbon campaign      ()    Hopeless ribbon campaign
/\    against HTML mail        /\  against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



Mime
View raw message