httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c
Date Mon, 06 May 2002 18:04:53 GMT
aaron       02/05/06 11:04:53

  Modified:    modules/mappers mod_rewrite.c
  Log:
  Add some error checking in mod_rewrite for the mutex lock/unlock calls.
  
  Revision  Changes    Path
  1.110     +28 -4     httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- mod_rewrite.c	6 May 2002 14:02:50 -0000	1.109
  +++ mod_rewrite.c	6 May 2002 18:04:53 -0000	1.110
  @@ -2928,6 +2928,7 @@
       char c;
       int i;
       apr_size_t nbytes;
  +    apr_status_t rv;
   
   #ifndef NO_WRITEV
       struct iovec iova[2];
  @@ -2946,7 +2947,13 @@
       /* 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 @@
   
       /* 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 @@
       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 @@
                   (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;
  
  
  

Mime
View raw message