Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 98060 invoked by uid 500); 21 Aug 2000 19:09:08 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk X-No-Archive: yes Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 98005 invoked by uid 500); 21 Aug 2000 19:09:06 -0000 Delivered-To: apmail-apache-2.0-cvs@apache.org Date: 21 Aug 2000 19:09:04 -0000 Message-ID: <20000821190904.97982.qmail@locus.apache.org> From: trawick@locus.apache.org To: apache-2.0-cvs@apache.org Subject: cvs commit: apache-2.0/src/modules/standard mod_rewrite.h mod_rewrite.c trawick 00/08/21 12:09:04 Modified: src CHANGES src/modules/standard mod_rewrite.h mod_rewrite.c Log: Fix some bad calls to ap_log_rerror() in mod_rewrite. In some places, errno was passed as the APR error code. In other places, 0 was passed. Revision Changes Path 1.210 +3 -0 apache-2.0/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-2.0/src/CHANGES,v retrieving revision 1.209 retrieving revision 1.210 diff -u -r1.209 -r1.210 --- CHANGES 2000/08/20 03:21:51 1.209 +++ CHANGES 2000/08/21 19:08:59 1.210 @@ -1,5 +1,8 @@ Changes with Apache 2.0a7 + *) Fix some bad calls to ap_log_rerror() in mod_rewrite. + [Jeff Trawick] + *) Update PCRE to version 3.2. [Ryan Bloom] *) Change the way buckets' destroy functions are called so that 1.17 +3 -3 apache-2.0/src/modules/standard/mod_rewrite.h Index: mod_rewrite.h =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- mod_rewrite.h 2000/08/03 03:09:32 1.16 +++ mod_rewrite.h 2000/08/21 19:09:01 1.17 @@ -438,9 +438,9 @@ /* program map support */ static void run_rewritemap_programs(server_rec *s, apr_pool_t *p); -static int rewritemap_program_child(apr_pool_t *p, const char *progname, - apr_file_t **fpout, apr_file_t **fpin, - apr_file_t **fperr); +static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname, + apr_file_t **fpout, apr_file_t **fpin, + apr_file_t **fperr); /* env variable support */ static void expand_variables_inbuffer(request_rec *r, char *buf, int buf_len); 1.40 +35 -24 apache-2.0/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- mod_rewrite.c 2000/08/12 02:31:38 1.39 +++ mod_rewrite.c 2000/08/21 19:09:01 1.40 @@ -799,6 +799,8 @@ /* arg2: the output string * replace the $ by \ which is needed by the currently * used Regular Expression library + * + * TODO: Is this still required for PCRE? If not, does it *work* with PCRE? */ newrule->output = apr_pstrdup(cmd->pool, a2); @@ -1021,9 +1023,17 @@ static void init_child(apr_pool_t *p, server_rec *s) { + apr_status_t rv; if (lockname != NULL && *(lockname) != '\0') - apr_child_init_lock (&rewrite_mapr_lock, lockname, p); + { + rv = apr_child_init_lock (&rewrite_mapr_lock, lockname, p); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, + "mod_rewrite: could not init rewrite_mapr_lock " + "in child"); + } + } /* create the lookup cache */ cachep = init_cache(p); @@ -2756,6 +2766,7 @@ rewritemap_entry *s; char *value; apr_finfo_t st; + apr_status_t rv; int i; /* get map configuration */ @@ -2769,8 +2780,8 @@ s = &entries[i]; if (strcmp(s->name, name) == 0) { if (s->type == MAPTYPE_TXT) { - if (apr_stat(&st, s->checkfile, r->pool) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + if ((rv = apr_stat(&st, s->checkfile, r->pool)) != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "mod_rewrite: can't access text RewriteMap " "file %s", s->checkfile); rewritelog(r, 1, "can't open RewriteMap file, " @@ -2806,8 +2817,8 @@ } else if (s->type == MAPTYPE_DBM) { #ifndef NO_DBM_REWRITEMAP - if (apr_stat(&st, s->checkfile, r->pool) != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, + if ((rv = apr_stat(&st, s->checkfile, r->pool)) != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "mod_rewrite: can't access DBM RewriteMap " "file %s", s->checkfile); rewritelog(r, 1, "can't open DBM RewriteMap file, " @@ -2868,8 +2879,8 @@ } } else if (s->type == MAPTYPE_RND) { - if (apr_stat(&st, s->checkfile, r->pool) == -1) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, + if ((rv = apr_stat(&st, s->checkfile, r->pool)) != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "mod_rewrite: can't access text RewriteMap " "file %s", s->checkfile); rewritelog(r, 1, "can't open RewriteMap file, " @@ -3199,7 +3210,7 @@ if (*conf->rewritelogfile == '|') { if ((pl = ap_open_piped_log(p, conf->rewritelogfile+1)) == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s, "mod_rewrite: could not open reliable pipe " "to RewriteLog filter %s", conf->rewritelogfile+1); exit(1); @@ -3209,7 +3220,7 @@ else if (*conf->rewritelogfile != '\0') { rc = apr_open(&conf->rewritelogfp, fname, rewritelog_flags, rewritelog_mode, p); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, "mod_rewrite: could not open RewriteLog " "file %s", fname); exit(1); @@ -3391,7 +3402,7 @@ rewritemap_entry *entries; rewritemap_entry *map; int i; - int rc; + apr_status_t rc; conf = ap_get_module_config(s->module_config, &rewrite_module); @@ -3420,9 +3431,9 @@ rc = rewritemap_program_child(p, map->datafile, &fpout, &fpin, &fperr); if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, "mod_rewrite: could not fork child for " - "RewriteMap process. %d", rc); + "RewriteMap process"); exit(1); } map->fpin = fpin; @@ -3433,11 +3444,11 @@ } /* child process code */ -static int rewritemap_program_child(apr_pool_t *p, const char *progname, - apr_file_t **fpout, apr_file_t **fpin, - apr_file_t **fperr) +static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname, + apr_file_t **fpout, apr_file_t **fpin, + apr_file_t **fperr) { - int rc = -1; + apr_status_t rc; apr_procattr_t *procattr; apr_proc_t *procnew; @@ -3446,15 +3457,15 @@ #endif - if ((apr_createprocattr_init(&procattr, p) != APR_SUCCESS) || - (apr_setprocattr_io(procattr, APR_FULL_BLOCK, - APR_FULL_NONBLOCK, - APR_FULL_NONBLOCK) != APR_SUCCESS) || - (apr_setprocattr_dir(procattr, ap_make_dirstr_parent(p, progname)) - != APR_SUCCESS) || - (apr_setprocattr_cmdtype(procattr, APR_PROGRAM) != APR_SUCCESS)) { + if (((rc = apr_createprocattr_init(&procattr, p)) != APR_SUCCESS) || + ((rc = apr_setprocattr_io(procattr, APR_FULL_BLOCK, + APR_FULL_NONBLOCK, + APR_FULL_NONBLOCK)) != APR_SUCCESS) || + ((rc = apr_setprocattr_dir(procattr, + ap_make_dirstr_parent(p, progname))) + != APR_SUCCESS) || + ((rc = apr_setprocattr_cmdtype(procattr, APR_PROGRAM)) != APR_SUCCESS)) { /* Something bad happened, give up and go away. */ - rc = -1; } else { procnew = apr_pcalloc(p, sizeof(*procnew));