httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Nicholes" <BNICHO...@novell.com>
Subject Re: cvs commit: httpd-2.0/modules/mappers mod_rewrite.c mod_rewrite.h
Date Mon, 06 May 2002 19:49:36 GMT
  Why are we calling a Unix specific function in the middle of a module?
 Since unixd_set_global_mutex_perms() doesn't exist on NetWare,
mod_rewrite won't compile.  Should this be handled in APR somewhere?

Brad



Brad Nicholes
Senior Software Engineer
Novell, Inc., a leading provider of Net business solutions
http://www.novell.com 

>>> aaron@apache.org Monday, May 06, 2002 12:24:04 PM >>>
aaron       02/05/06 11:24:04

  Modified:    modules/mappers mod_rewrite.c mod_rewrite.h
  Log:
  Fix mod_rewrite hang when APR uses SysV Semaphores. Before we were
  silently failing when locking/unlocking the mutex, since httpd
  child processes didn't have permissions to access the root-created
  semaphore.
  
  PR: 8143
  
  Revision  Changes    Path
  1.111     +26 -6     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.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- mod_rewrite.c	6 May 2002 18:04:53 -0000	1.110
  +++ mod_rewrite.c	6 May 2002 18:24:03 -0000	1.111
  @@ -964,7 +964,19 @@
           return HTTP_INTERNAL_SERVER_ERROR;
       }
   
  -    rewritelock_create(s, p);
  +    rv = unixd_set_global_mutex_perms(rewrite_log_lock);
  +    if (rv != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
  +                     "mod_rewrite: Could not set permissions on "
  +                     "rewrite_log_lock; check User and Group
directives");
  +        return HTTP_INTERNAL_SERVER_ERROR;
  +    }
  +
  +    rv = rewritelock_create(s, p);
  +    if (rv != APR_SUCCESS) {
  +        return HTTP_INTERNAL_SERVER_ERROR;
  +    }
  +
       apr_pool_cleanup_register(p, (void *)s, rewritelock_remove,
apr_pool_cleanup_null);
   
       /* step through the servers and
  @@ -3296,26 +3308,34 @@
   
   #define REWRITELOCK_MODE ( APR_UREAD | APR_UWRITE | APR_GREAD |
APR_WREAD )
   
  -static void rewritelock_create(server_rec *s, apr_pool_t *p)
  +static apr_status_t rewritelock_create(server_rec *s, apr_pool_t
*p)
   {
       apr_status_t rc;
   
       /* only operate if a lockfile is used */
       if (lockname == NULL || *(lockname) == '\0') {
  -        return;
  +        return APR_EINVAL;
       }
   
       /* create the lockfile */
       rc = apr_global_mutex_create(&rewrite_mapr_lock_acquire,
lockname,
                                    APR_LOCK_DEFAULT, p);
       if (rc != APR_SUCCESS) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s,
                        "mod_rewrite: Parent could not create
RewriteLock "
                        "file %s", lockname);
  -        exit(1);
  +        return rc;
       }
   
  -    return;
  +    rc = unixd_set_global_mutex_perms(rewrite_mapr_lock_acquire);
  +    if (rc != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s,
  +                     "mod_rewrite: Parent could not set permissions
"
  +                     "on RewriteLock; check User and Group
directives");
  +        return rc;
  +    }
  +
  +    return APR_SUCCESS;
   }
   
   static apr_status_t rewritelock_remove(void *data)
  
  
  
  1.32      +1 -1      httpd-2.0/modules/mappers/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- mod_rewrite.h	6 May 2002 03:10:24 -0000	1.31
  +++ mod_rewrite.h	6 May 2002 18:24:03 -0000	1.32
  @@ -451,7 +451,7 @@
   static char *current_logtime(request_rec *r);
   
       /* rewriting lockfile support */
  -static void rewritelock_create(server_rec *s, apr_pool_t *p);
  +static apr_status_t rewritelock_create(server_rec *s, apr_pool_t
*p);
   static apr_status_t rewritelock_remove(void *data);
   
       /* program map support */
  
  
  

Mime
View raw message