apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/locks/win32 locks.c
Date Fri, 01 Feb 2002 06:21:34 GMT
wrowe       02/01/31 22:21:34

  Modified:    locks/win32 locks.c
  Log:
    Win32 mod_rewrite was broken by the implicit assumption that fname would
    have a value.  Of course, fname may be NULL, in which case this patch
    from 1.46 broke any NULL locking.  Correct the Local/Global fix for NULL
    lock names.
  
    Oh most excelent RM of .31, please consider this patch, without which
    mod_rewrite will not load.
  
  Revision  Changes    Path
  1.49      +29 -6     apr/locks/win32/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/win32/locks.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- locks.c	29 Dec 2001 23:14:22 -0000	1.48
  +++ locks.c	1 Feb 2002 06:21:34 -0000	1.49
  @@ -119,7 +119,12 @@
       }
   
       if (scope == APR_INTRAPROCESS) {
  -        newlock->fname = apr_pstrdup(pool, fname);
  +        if (fname) {
  +            newlock->fname = apr_pstrdup(pool, fname);
  +        }
  +        else {
  +            newlock->fname = NULL;
  +        }
           InitializeCriticalSection(&newlock->section);
       } else {
           /* With Win2000 Terminal Services, the Mutex name can have a 
  @@ -128,10 +133,17 @@
            * running on Win2000, Global\ and Local\ are ignored.  These
            * prefixes are only valid on Win2000+
            */
  -        if (apr_os_level >= APR_WIN_2000)
  -            newlock->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
  -        else
  -            newlock->fname = apr_pstrdup(pool, fname);
  +        if (fname) {
  +            if (apr_os_level >= APR_WIN_2000) {
  +                newlock->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
  +            }
  +            else {
  +                newlock->fname = apr_pstrdup(pool, fname);
  +            }
  +        }
  +        else {
  +            newlock->fname = NULL;
  +        }
   
           newlock->mutex = CreateMutex(&sec, FALSE, newlock->fname);
           if (!newlock->mutex) {
  @@ -156,7 +168,18 @@
       if ((*lock) == NULL) {
           return APR_ENOMEM;
       }
  -    (*lock)->fname = apr_pstrdup(pool, fname);
  +    if (fname) {
  +        if (apr_os_level >= APR_WIN_2000) {
  +            (*lock)->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
  +        }
  +        else {
  +            (*lock)->fname = apr_pstrdup(pool, fname);
  +        }
  +    }
  +    else {
  +        return APR_EINVAL;
  +    }
  +
       (*lock)->mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, fname);
       
       if ((*lock)->mutex == NULL) {
  
  
  

Mime
View raw message