]> granicus.if.org Git - apache/commitdiff
mod_rewrite: Fix some problems reporting errors with mapping
authorJeff Trawick <trawick@apache.org>
Fri, 28 Feb 2003 13:13:39 +0000 (13:13 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 28 Feb 2003 13:13:39 +0000 (13:13 +0000)
programs (RewriteMap prg:/something).

the wrong field was specified when trying to log the name of
the program that couldn't be started

recent APR features used to provide better error reporting
on systems where apr_proc_create() uses fork()

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98840 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index 488e0ececfae3671f67be8290ab72576dc4f54cc..69dea037bbb9f6f7c90f318eb35fa5ccb57b5b77 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_rewrite: Fix some problems reporting errors with mapping
+     programs (RewriteMap prg:/something).  [Jeff Trawick]
+
   *) Win32: Avoid busy wait (consuming all the CPU idle cycles) when
      all worker threads are busy. 
     [Igor Nazarenko <igor_nazarenko@hotmail.com>]
index c2c3c725419151096584c74910be7c4ed40d238b..2d38bccdd22eafece384537f3b0c4c1c0b398cc8 100644 (file)
@@ -3568,8 +3568,8 @@ static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p)
                                       &fpout, &fpin);
         if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) {
             ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
-                         "mod_rewrite: could not startup RewriteMap "
-                         "program %s", map->datafile);
+                         "mod_rewrite: could not start RewriteMap "
+                         "program %s", map->checkfile);
             return rc;
         }
         map->fpin  = fpin;
@@ -3579,6 +3579,14 @@ static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p)
 }
 
 /* child process code */
+
+static void rewrite_child_errfn(apr_pool_t *p, apr_status_t err,
+                                const char *desc)
+{
+    ap_log_error(APLOG_MARK, APLOG_ERR, err, NULL,
+                 "%s", desc);
+}
+
 static apr_status_t rewritemap_program_child(apr_pool_t *p,
                                              const char *progname, char **argv,
                                              apr_file_t **fpout,
@@ -3594,8 +3602,10 @@ static apr_status_t rewritemap_program_child(apr_pool_t *p,
         ((rc = apr_procattr_dir_set(procattr,
                                    ap_make_dirstr_parent(p, argv[0])))
          != APR_SUCCESS) ||
-        ((rc = apr_procattr_cmdtype_set(procattr, APR_PROGRAM))
-         != APR_SUCCESS)) {
+        ((rc = apr_procattr_cmdtype_set(procattr, APR_PROGRAM)) != APR_SUCCESS) ||
+        ((rc = apr_procattr_child_errfn_set(procattr, rewrite_child_errfn)) != APR_SUCCESS) ||
+        ((rc = apr_procattr_error_check_set(procattr, 1)) != APR_SUCCESS) ||
+        ((rc = apr_procattr_cmdtype_set(procattr, APR_PROGRAM)) != APR_SUCCESS)) {
         /* Something bad happened, give up and go away. */
     }
     else {