Author: stevehay Date: Thu Nov 20 10:12:31 2008 New Revision: 719313 URL: http://svn.apache.org/viewvc?rev=719313&view=rev Log: Hopefully fix the crash-on-startup problem found in 1.31-RC4 way back in April. (See http://marc.info/?t=120716940300003&r=1&w=2 and especially http://marc.info/?l=apache-modperl-dev&m=120886179707098&w=2 .) I think the uninitialized PL_perlio_mutex referred to there was the problem, and happened because PERL_SYS_INIT hadn't been called because USE_THREADS isn't defined (I have USE_ITHREADS instead, which is different). Actually, according to perlembed, PERL_SYS_INIT/PERL_SYS_TERM should always be called (if they are defined), so just do that. (Revision 151364 did a similar thing for mod_perl2, which was missing these calls completely.) Having changed it so that they get called, I then found that PERL_SYS_INIT caused a warning about arg2 being the wrong type, so a cast is also needed to fix that.
Modified: perl/modperl/branches/1.x/Changes perl/modperl/branches/1.x/src/modules/perl/mod_perl.c Modified: perl/modperl/branches/1.x/Changes URL: http://svn.apache.org/viewvc/perl/modperl/branches/1.x/Changes?rev=719313&r1=719312&r2=719313&view=diff ============================================================================== --- perl/modperl/branches/1.x/Changes (original) +++ perl/modperl/branches/1.x/Changes Thu Nov 20 10:12:31 2008 @@ -10,6 +10,11 @@ =item 1.31-dev +Win32 needs PERL_SYS_INIT/PERL_SYS_TERM calls when built with +USE_ITHREADS [sic--that's different to USE_THREADS]. In fact, +they ought to be always called if they are defined +[Steve Hay] + Fix potential segfault when the environment contains NULL values [Mike Schilli] Modified: perl/modperl/branches/1.x/src/modules/perl/mod_perl.c URL: http://svn.apache.org/viewvc/perl/modperl/branches/1.x/src/modules/perl/mod_perl.c?rev=719313&r1=719312&r2=719313&view=diff ============================================================================== --- perl/modperl/branches/1.x/src/modules/perl/mod_perl.c (original) +++ perl/modperl/branches/1.x/src/modules/perl/mod_perl.c Thu Nov 20 10:12:31 2008 @@ -289,7 +289,7 @@ perl_destruct(perl); perl_free(perl); -#ifdef USE_THREADS +#ifdef PERL_SYS_TERM PERL_SYS_TERM(); #endif @@ -678,10 +678,8 @@ MP_TRACE_g(fprintf(stderr, "'%s' ", argv[i])); MP_TRACE_g(fprintf(stderr, "...")); -#ifdef USE_THREADS -# ifdef PERL_SYS_INIT - PERL_SYS_INIT(&argc,&argv); -# endif +#ifdef PERL_SYS_INIT + PERL_SYS_INIT(&argc,(char***)&argv); #endif #ifndef perl_init_i18nl10n