
richter at apache
Aug 9, 2004, 12:44 PM
Post #1 of 1
(826 views)
Permalink
|
|
cvs commit: embperl Changes.pod Old.xs ep.h epinit.c eputil.c
|
|
richter 2004/08/09 12:44:45 Modified: . Changes.pod Old.xs ep.h epinit.c eputil.c Log: fix segafult within warning during initialisation Revision Changes Path 1.243 +3 -1 embperl/Changes.pod Index: Changes.pod =================================================================== RCS file: /home/cvs/embperl/Changes.pod,v retrieving revision 1.242 retrieving revision 1.243 diff -u -r1.242 -r1.243 --- Changes.pod 20 Jul 2004 08:25:21 -0000 1.242 +++ Changes.pod 9 Aug 2004 19:44:44 -0000 1.243 @@ -13,7 +13,9 @@ - Fixed test and compile problems on Windows with Perl 5.8.3 - Added more verbose error informations for PerlHash error - Fixed problem when unloading Embperl.so under Apache, which cause - Perl Hash error and/or segfault. + Perl Hash error and/or segfault. + - Fixed SegFault that occured when a Perl warning should be logged during + initialisation. =head1 2.0b11 15. March 2004 1.8 +15 -5 embperl/Old.xs Index: Old.xs =================================================================== RCS file: /home/cvs/embperl/Old.xs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Old.xs 14 Mar 2004 18:54:43 -0000 1.7 +++ Old.xs 9 Aug 2004 19:44:44 -0000 1.8 @@ -60,8 +60,13 @@ r -> pApacheReqSV = pApacheReqSV ; } #endif - strncpy (r->errdat1, sText, sizeof (r->errdat1) - 1) ; - LogError (r,code) ; + if (r) + { + strncpy (r->errdat1, sText, sizeof (r->errdat1) - 1) ; + LogError (r,code) ; + } + else + LogErrorParam(NULL, code, sText, NULL) ; #ifdef APACHE if (bRestore) { @@ -139,7 +144,7 @@ INIT: tReq * r = CurrReq ; CODE: - RETVAL = r -> Component.sSourcefile ; + RETVAL = r?r -> Component.sSourcefile:"" ; OUTPUT: RETVAL @@ -210,8 +215,13 @@ r -> pApacheReqSV = pApacheReqSV ; } #endif - strncpy (r->errdat1, sText, sizeof (r->errdat1) - 1) ; - LogError (r,code) ; + if (r) + { + strncpy (r->errdat1, sText, sizeof (r->errdat1) - 1) ; + LogError (r,code) ; + } + else + LogErrorParam(NULL, code, sText, NULL) ; #ifdef APACHE if (bRestore) { 1.43 +19 -20 embperl/ep.h Index: ep.h =================================================================== RCS file: /home/cvs/embperl/ep.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- ep.h 8 Jul 2004 08:31:00 -0000 1.42 +++ ep.h 9 Aug 2004 19:44:44 -0000 1.43 @@ -718,47 +718,46 @@ #undef newSV -#define newSV(len) AddDMallocMagic(Perl_newSV((len)), "newSV ", __FILE__, __LINE__) +#define newSV(len) AddDMallocMagic(Perl_newSV(aTHX_ (len)), "newSV ", __FILE__, __LINE__) #undef newSViv -#define newSViv(i) AddDMallocMagic(Perl_newSViv((i)), "newSViv ", __FILE__, __LINE__) -#define newSVivDBG1(i,txt) AddDMallocMagic(Perl_newSViv((i)), txt, __FILE__, __LINE__) +#define newSViv(i) AddDMallocMagic(Perl_newSViv(aTHX_ (i)), "newSViv ", __FILE__, __LINE__) +#define newSVivDBG1(i,txt) AddDMallocMagic(Perl_newSViv(aTHX_ (i)), txt, __FILE__, __LINE__) #undef newSVnv -#define newSVnv(n) AddDMallocMagic(Perl_newSVnv((n)), "newSVnv ", __FILE__, __LINE__) +#define newSVnv(n) AddDMallocMagic(Perl_newSVnv(aTHX_ (n)), "newSVnv ", __FILE__, __LINE__) #undef newSVpv -#define newSVpv(s,len) AddDMallocMagic(Perl_newSVpv((s),(len)), "newSVpv ", __FILE__, __LINE__) +#define newSVpv(s,len) AddDMallocMagic(Perl_newSVpv(aTHX_ (s),(len)), "newSVpv ", __FILE__, __LINE__) #undef newSVpvn -#define newSVpvn(s,len) AddDMallocMagic(Perl_newSVpvn((s),(len)), "newSVpvn ", __FILE__, __LINE__) +#define newSVpvn(s,len) AddDMallocMagic(Perl_newSVpvn(aTHX_ (s),(len)), "newSVpvn ", __FILE__, __LINE__) #undef newSVrv -#define newSVrv(rv,c) AddDMallocMagic(Perl_newSVrv((rv),(c)), "newSVrv ", __FILE__, __LINE__) +#define newSVrv(rv,c) AddDMallocMagic(Perl_newSVrv(aTHX_ (rv),(c)), "newSVrv ", __FILE__, __LINE__) #undef newSVsv -#define newSVsv(sv) AddDMallocMagic(Perl_newSVsv((sv)), "newSVsv ", __FILE__, __LINE__) +#define newSVsv(sv) AddDMallocMagic(Perl_newSVsv(aTHX_ (sv)), "newSVsv ", __FILE__, __LINE__) #undef newSVpvf2 #define newSVpvf2(sv) AddDMallocMagic((sv), "newSVsvf ", __FILE__, __LINE__) ; SvTAINTED_off (sv) #undef perl_get_sv -#define perl_get_sv(name,create) AddDMallocMagic(perl_get_sv(name,create), "perl_get_sv ", __FILE__, __LINE__) - -#undef perl_get_cv -#define perl_get_cv(name,create) (CV *)AddDMallocMagic((SV *)perl_get_cv(name,create), "perl_get_cv ", __FILE__, __LINE__) - -#undef perl_get_hv -#define perl_get_hv(name,create) (HV *)AddDMallocMagic((SV *)perl_get_hv(name,create), "perl_get_hv ", __FILE__, __LINE__) - -#undef perl_get_av -#define perl_get_av(name,create) (AV *)AddDMallocMagic((SV *)perl_get_av(name,create), "perl_get_av ", __FILE__, __LINE__) +#undef perl_get_cv +#undef perl_get_hv +#undef perl_get_av + + +#define perl_get_sv(name,create) AddDMallocMagic(Perl_get_sv(aTHX_ name,create), "perl_get_sv ", __FILE__, __LINE__) +#define perl_get_cv(name,create) (CV *)AddDMallocMagic((SV *)Perl_get_cv(aTHX_ name,create), "perl_get_cv ", __FILE__, __LINE__) +#define perl_get_hv(name,create) (HV *)AddDMallocMagic((SV *)Perl_get_hv(aTHX_ name,create), "perl_get_hv ", __FILE__, __LINE__) +#define perl_get_av(name,create) (AV *)AddDMallocMagic((SV *)Perl_get_av(aTHX_ name,create), "perl_get_av ", __FILE__, __LINE__) #undef newHV -#define newHV() (HV *)AddDMallocMagic((SV *)Perl_newHV(), "newHV ", __FILE__, __LINE__) +#define newHV() (HV *)AddDMallocMagic((SV *)Perl_newHV(aTHX), "newHV ", __FILE__, __LINE__) #undef newAV -#define newAV() (AV *)AddDMallocMagic((SV *)Perl_newAV(), "newAV ", __FILE__, __LINE__) +#define newAV() (AV *)AddDMallocMagic((SV *)Perl_newAV(aTHX), "newAV ", __FILE__, __LINE__) #else 1.15 +5 -6 embperl/epinit.c Index: epinit.c =================================================================== RCS file: /home/cvs/embperl/epinit.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- epinit.c 20 Jul 2004 08:25:23 -0000 1.14 +++ epinit.c 9 Aug 2004 19:44:44 -0000 1.15 @@ -26,7 +26,6 @@ storing a PL_sv_undef with Perl 5.8.0 in a hash Perl takes it as a placeholder and pretents it isn't there :-( */ - #ifndef PERL_IMPLICIT_CONTEXT SV * embperl_ThreadDataRV ; @@ -1250,7 +1249,7 @@ static void embperl_LogStartReq (/*i/o*/ req * r) { - epTHX ; + epTHX ; if (r -> Config.bDebug) { @@ -1258,7 +1257,7 @@ lprintf (r -> pApp, "[%d]REQ: ***** Start Request at %s", r -> pThread -> nPid, ctime (&t)) ; lprintf (r -> pApp, "[%d]Use App: %s\n", r -> pApp -> pThread -> nPid, r -> pApp -> Config.sAppName) ; #ifdef DMALLOC - dmalloc_message ("[%d]REQ: Start Request at %s\n", r -> pThread -> nPid, ctime (time(NULL))) ; + dmalloc_message ("[%d]REQ: Start Request at %s\n", r -> pThread -> nPid, ctime (&t)) ; #endif } @@ -1798,8 +1797,8 @@ #ifdef DMALLOC /* unsigned long mark, int not_freed_b, int freed_b, int details_b */ dmalloc_log_changed (r -> MemCheckpoint, 1, 0, 1) ; - dmalloc_message ( "[%d]%sRequest freed. Entry-SVs: %d -OBJs: %d Exit-SVs: %d -OBJs: %d\n", r -> pThread -> nPid, - (r -> Component.pPrev?"Sub-":""), r -> stsv_count, r -> stsv_objcount, sv_count, sv_objcount) ; + dmalloc_message ( "[%d]%sRequest freed. Entry-SVs: %d -OBJs: %%d Exit-SVs: %d -OBJs: %%d\n", r -> pThread -> nPid, + (r -> Component.pPrev?"Sub-":""), r -> stsv_count, /*r -> stsv_objcount, */sv_count/*, sv_objcount*/) ; #endif if (r -> Config.bDebug) DomStats (r -> pApp) ; 1.38 +14 -7 embperl/eputil.c Index: eputil.c =================================================================== RCS file: /home/cvs/embperl/eputil.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- eputil.c 7 Mar 2004 19:44:14 -0000 1.37 +++ eputil.c 9 Aug 2004 19:44:44 -0000 1.38 @@ -19,7 +19,6 @@ #include "epmacro.h" - /* ---------------------------------------------------------------------------- */ /* Output a string and escape html special character to html special */ /* representation (&xxx;) */ @@ -1076,8 +1075,12 @@ int GetLineNo (/*i/o*/ register req * r) { - char * pPos = r -> Component.pCurrPos ; + char * pPos ; + + if (r == NULL) + return 0 ; + pPos = r -> Component.pCurrPos ; return GetLineNoOf (r, pPos) ; } @@ -2046,6 +2049,8 @@ } static MGVTBL DMalloc_mvtTab = { NULL, NULL, NULL, NULL, RemoveDMallocMagic } ; + +#define MGTTYPE '.' SV * AddDMallocMagic (/*in*/ SV * pSV, /*in*/ char * sText, @@ -2053,15 +2058,17 @@ /*in*/ int nLine) { - if (pSV && (!SvMAGICAL(pSV) || !mg_find (pSV, '~'))) + dTHX ; + + if (pSV && (!SvMAGICAL(pSV) || !mg_find (pSV, MGTTYPE))) { char * s = _strdup_leap(sFile, nLine, sText) ; struct magic * pMagic ; - if ((!SvMAGICAL(pSV) || !(pMagic = mg_find (pSV, '~')))) + if ((!SvMAGICAL(pSV) || !(pMagic = mg_find (pSV, MGTTYPE)))) { - sv_magic ((SV *)pSV, NULL, '~', (char *)&s, sizeof (s)) ; - pMagic = mg_find (pSV, '~') ; + sv_magic ((SV *)pSV, NULL, MGTTYPE, (char *)&s, sizeof (s)) ; + pMagic = mg_find (pSV, MGTTYPE) ; } if (pMagic) --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscribe [at] perl For additional commands, e-mail: embperl-cvs-help [at] perl
|