You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Torsten Foertsch <to...@gmx.net> on 2008/08/01 19:22:59 UTC

MP_FUNC & MP_CHECK_WBUCKET_INIT

Hi,

MP_FUNC is NULL unless MP_TRACE is set (modperl_common_log.h).

MP_CHECK_WBUCKET_INIT is defined as (modperl_util.h):

#define MP_CHECK_WBUCKET_INIT(func) \
    if (!rcfg->wbucket) { \
        Perl_croak(aTHX_ "%s: " func " can't be called "  \
                   "before the response phase", MP_FUNC); \
    }

It doesn't check for MP_TRACE and hence passes a NULL pointer to
Perl_croak(%s).

How about this fix?

Index: src/modules/perl/modperl_util.h
===================================================================
--- src/modules/perl/modperl_util.h     (revision 681109)
+++ src/modules/perl/modperl_util.h     (working copy)
@@ -20,11 +20,19 @@
 #include "modperl_common_util.h"

 /* check whether the response phase has been initialized already */
-#define MP_CHECK_WBUCKET_INIT(func) \
-    if (!rcfg->wbucket) { \
-        Perl_croak(aTHX_ "%s: " func " can't be called "  \
-                   "before the response phase", MP_FUNC); \
+#ifdef MP_TRACE
+#   define MP_CHECK_WBUCKET_INIT(func) \
+        if (!rcfg->wbucket) { \
+            Perl_croak(aTHX_ "%s: " func " can't be called " \
+                       "before the response phase", MP_FUNC); \
     }
+#else
+#   define MP_CHECK_WBUCKET_INIT(func) \
+        if (!rcfg->wbucket) { \
+            Perl_croak(aTHX_ func " can't be called " \
+                       "before the response phase"); \
+    }
+#endif

 /* turn off cgi header parsing. in case we are already inside
  *     modperl_callback_per_dir(MP_RESPONSE_HANDLER, r, MP_HOOK_RUN_FIRST);


--
Need professional mod_perl support?
Just hire me: torsten.foertsch@gmx.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: MP_FUNC & MP_CHECK_WBUCKET_INIT

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Torsten Foertsch wrote:
> Hi,
> 
> MP_FUNC is NULL unless MP_TRACE is set (modperl_common_log.h).
> 
> MP_CHECK_WBUCKET_INIT is defined as (modperl_util.h):
> 
> #define MP_CHECK_WBUCKET_INIT(func) \
>     if (!rcfg->wbucket) { \
>         Perl_croak(aTHX_ "%s: " func " can't be called "  \
>                    "before the response phase", MP_FUNC); \
>     }
> 
> It doesn't check for MP_TRACE and hence passes a NULL pointer to
> Perl_croak(%s).
Makes sense to me.  I compile with MP_TRACE=1 all the time and even have 
flags 'A'.  How have I not hit this yet  ?

P.S.
I didn't actually look at the modperl_common_log.h



-- 
------------------------------------------------------------------------
Philip M. Gollucci (philip@ridecharge.com)
o:703.549.2050x206
Senior System Admin - Riderway, Inc.
http://riderway.com / http://ridecharge.com
1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org