From: Aaron Bannert Date: Mon, 6 May 2002 18:04:53 +0000 (+0000) Subject: Add some error checking in mod_rewrite for the mutex lock/unlock calls. X-Git-Tag: 2.0.37~481 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00d5972391db4363d78323467e89ae4d940b8c89;p=apache Add some error checking in mod_rewrite for the mutex lock/unlock calls. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94967 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index b0cdef5ff9..bde7016116 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -2928,6 +2928,7 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin, char c; int i; apr_size_t nbytes; + apr_status_t rv; #ifndef NO_WRITEV struct iovec iova[2]; @@ -2946,7 +2947,13 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin, /* take the lock */ if (rewrite_mapr_lock_acquire) { - apr_global_mutex_lock(rewrite_mapr_lock_acquire); + rv = apr_global_mutex_lock(rewrite_mapr_lock_acquire); + if (rv != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "apr_global_mutex_lock(rewrite_mapr_lock_acquire) " + "failed"); + return NULL; /* Maybe this should be fatal? */ + } } /* write out the request key */ @@ -2981,7 +2988,13 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin, /* give the lock back */ if (rewrite_mapr_lock_acquire) { - apr_global_mutex_unlock(rewrite_mapr_lock_acquire); + rv = apr_global_mutex_unlock(rewrite_mapr_lock_acquire); + if (rv != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "apr_global_mutex_unlock(rewrite_mapr_lock_acquire) " + "failed"); + return NULL; /* Maybe this should be fatal? */ + } } if (strcasecmp(buf, "NULL") == 0) { @@ -3171,6 +3184,7 @@ static void rewritelog(request_rec *r, int level, const char *text, ...) request_rec *req; char *ruser; const char *rhost; + apr_status_t rv; va_start(ap, text); conf = ap_get_module_config(r->server->module_config, &rewrite_module); @@ -3235,10 +3249,20 @@ static void rewritelog(request_rec *r, int level, const char *text, ...) (unsigned long)(r->server), (unsigned long)r, type, redir, level, str2); - apr_global_mutex_lock(rewrite_log_lock); + rv = apr_global_mutex_lock(rewrite_log_lock); + if (rv != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "apr_global_mutex_lock(rewrite_log_lock) failed"); + /* XXX: Maybe this should be fatal? */ + } nbytes = strlen(str3); apr_file_write(conf->rewritelogfp, str3, &nbytes); - apr_global_mutex_unlock(rewrite_log_lock); + rv = apr_global_mutex_unlock(rewrite_log_lock); + if (rv != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "apr_global_mutex_unlock(rewrite_log_lock) failed"); + /* XXX: Maybe this should be fatal? */ + } va_end(ap); return;