[removing p5p people from CC]

Randy Kobes wrote:

It works for me - just to summarize, and to include Steve's
patch for the fprintf problem, here's what I used:
=========================================================
Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.183
diff -u -r1.183 mod_perl.c
--- src/modules/perl/mod_perl.c 11 Sep 2003 18:10:39 -0000      1.183
+++ src/modules/perl/mod_perl.c 16 Sep 2003 03:23:00 -0000
@@ -22,7 +22,7 @@
 #endif

 /* see modperl_hash_seed_set() */
-static void modperl_hash_seed_init(apr_pool_t *p)
+static void modperl_hash_seed_init(pTHX_ apr_pool_t *p)
 {
 #ifdef MP_NEED_HASH_SEED_FIXUP
     char *s;
@@ -41,7 +41,7 @@

     /* calculate our own random hash seed */
     if (!MP_init_hash_seed_set) {
-        apr_uuid_t *uuid = (apr_uuid_t *)safemalloc(sizeof(apr_uuid_t));
+        apr_uuid_t *uuid = (apr_uuid_t *)apr_palloc(p, sizeof(apr_uuid_t));

That part is now committed.


         char buf[APR_UUID_FORMATTED_LENGTH + 1];
         int i;

@@ -63,8 +63,8 @@
         if (s) {
             int i = atoi(s);
             if (i == 1) {
-                fprintf(stderr, "\nmod_perl: using init hash seed: %"UVuf"\n",
-                        MP_init_hash_seed);
+                PerlIO_printf(Perl_error_log, "\nmod_perl: using init hash seed: 
%"UVuf"\n",
+                              MP_init_hash_seed);
             }
         }
     }
@@ -587,10 +587,12 @@
 int modperl_hook_pre_config(apr_pool_t *p, apr_pool_t *plog,
                             apr_pool_t *ptemp)
 {
+    dTHX;
+
     /* we can't have PerlPreConfigHandler without first configuring mod_perl */

     /* perl 5.8.1+ */
-    modperl_hash_seed_init(p);
+    modperl_hash_seed_init(aTHX_ p);

That part I'm not happy about. Perl is not running at this point, so I'd rather not call perl functions here. I suggest another alternative, with the bonus that it now is logged into the error_log file if you have a sufficiently high LogLevel setting (Info or higher). I had to move the printout away from the code that generates it, but that's the first place where we can normally log to error_log.


Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.184
diff -u -r1.184 mod_perl.c
--- src/modules/perl/mod_perl.c 16 Sep 2003 05:01:38 -0000      1.184
+++ src/modules/perl/mod_perl.c 16 Sep 2003 05:45:48 -0000
@@ -57,17 +57,6 @@

         MP_init_hash_seed_set = TRUE;
     }
-
-    rv = apr_env_get(&s, "PERL_HASH_SEED_DEBUG", p);
-    if (rv == APR_SUCCESS) {
-        if (s) {
-            int i = atoi(s);
-            if (i == 1) {
-                fprintf(stderr, "\nmod_perl: using init hash seed: %"UVuf"\n",
-                        MP_init_hash_seed);
-            }
-        }
-    }
 #endif
 }

@@ -619,6 +608,11 @@
     modperl_init_clones(s, pconf);
 #endif

+#ifdef MP_NEED_HASH_SEED_FIXUP
+    ap_log_error(APLOG_MARK, APLOG_INFO, 0, s,
+                 "mod_perl: using Perl HASH_SEED: %"UVuf, MP_init_hash_seed);
+#endif
+
     return OK;
 }



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to