perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NormW <no...@gknw.net>
Subject Re: mod_perl-2.0.8 + OWC
Date Mon, 22 Apr 2013 21:54:20 GMT
On 22/04/2013 8:48 PM, Phil Carmody wrote:
>> 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
Hi,
And thanks for the meta-physical boot to have a closer look myself. I 
used to compile Perl and Mod_Perl with an old Metrowerks compiler and it 
used to bark whenever anything wasn't initialised before using, even it 
seemed when on the left-hand side. When OWC did the same I must have 
just added the '= 0' as a (in a?) hangover, without checking the code, 
and of course the warning disappeared, so took it as all is well.

Based on fd non-usage in the present code, and commented out from at 
least 2.0.4, I'll revise my patch to remove fd as you suggest.
Thanks for the feedback.

Norm

Mime
View raw message