You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/08/12 04:31:39 UTC
cvs commit: apache-2.0/src/modules/standard mod_rewrite.c
trawick 00/08/11 19:31:38
Modified: src/modules/standard mod_rewrite.c
Log:
Change the rewrite log lock from intra-process to lock-all (and we really can
log it if it fails).
Don't segfault if RewriteLock wasn't coded in the config (i.e., if
rewrite_log_lock isn't set).
Fix a missing error code in a call to ap_log_error().
Revision Changes Path
1.39 +15 -7 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.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- mod_rewrite.c 2000/08/06 06:07:47 1.38
+++ mod_rewrite.c 2000/08/12 02:31:38 1.39
@@ -982,14 +982,18 @@
apr_pool_t *ptemp,
server_rec *s)
{
+ apr_status_t rv;
+
/* check if proxy module is available */
proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL);
/* create the rewriting lockfiles in the parent */
- if (apr_create_lock (&rewrite_log_lock, APR_MUTEX, APR_INTRAPROCESS,
- NULL, NULL) != APR_SUCCESS)
- exit(1); /* ugly but I can't log anything yet. This is what */
- /* the pre-existing rewritelock_create code did. */
+ if ((rv = apr_create_lock (&rewrite_log_lock, APR_MUTEX, APR_LOCKALL,
+ NULL, NULL)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
+ "mod_rewrite: could not create rewrite_log_lock");
+ exit(1);
+ }
rewritelock_create(s, p);
apr_register_cleanup(p, (void *)s, rewritelock_remove, apr_null_cleanup);
@@ -3006,7 +3010,9 @@
/* take the lock */
- apr_lock(rewrite_mapr_lock);
+ if (rewrite_mapr_lock) {
+ apr_lock(rewrite_mapr_lock);
+ }
/* write out the request key */
#ifdef NO_WRITEV
@@ -3039,7 +3045,9 @@
buf[i] = '\0';
/* give the lock back */
- apr_unlock(rewrite_mapr_lock);
+ if (rewrite_mapr_lock) {
+ apr_unlock(rewrite_mapr_lock);
+ }
if (strcasecmp(buf, "NULL") == 0) {
return NULL;
@@ -3341,7 +3349,7 @@
/* create the lockfile */
rc = apr_create_lock (&rewrite_mapr_lock, APR_MUTEX, APR_LOCKALL, lockname, 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: Parent could not create RewriteLock "
"file %s", lockname);
exit(1);