You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2001/06/25 22:23:20 UTC

cvs commit: apr/locks/unix crossproc.c locks.c

trawick     01/06/25 13:23:20

  Modified:    locks/unix crossproc.c locks.c
  Log:
  Fix a few errors in the previous commit which affect locks on Unix:
  
  . don't return APR_SUCCESS for failures in create_lock()
  . don't return APR_ENOTIMPL for a request to create a lock with scope
    APR_LOCK_ALL when !APR_HAS_THREADS
  . when using flock(), get the new apr_lock_t constructed properly in
    the child init method
  
  Revision  Changes    Path
  1.47      +7 -1      apr/locks/unix/crossproc.c
  
  Index: crossproc.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/crossproc.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- crossproc.c	2001/06/25 18:53:35	1.46
  +++ crossproc.c	2001/06/25 20:23:14	1.47
  @@ -486,8 +486,14 @@
   {
       apr_lock_t *new;
   
  -    new = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  +    new = (apr_lock_t *)apr_pcalloc(cont, sizeof(apr_lock_t));
   
  +    new->pool = cont;
  +    new->meth = (*lock)->meth;
  +    new->inter_meth = (*lock)->inter_meth;
  +    new->intra_meth = NULL;
  +    new->type = (*lock)->type;
  +    new->scope = (*lock)->scope;
       new->fname = apr_pstrdup(cont, fname);
       new->interproc = open(new->fname, O_WRONLY, 0600);
       if (new->interproc == -1) {
  
  
  
  1.55      +4 -2      apr/locks/unix/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/locks.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- locks.c	2001/06/25 18:53:36	1.54
  +++ locks.c	2001/06/25 20:23:16	1.55
  @@ -157,7 +157,9 @@
               new->intra_meth = &apr_unix_intra_methods;
           }
   #else
  -        return APR_ENOTIMPL; /* 'cause we don't have threads */
  +        if (new->scope == APR_INTRAPROCESS) {
  +            return APR_ENOTIMPL; /* 'cause we don't have threads */
  +        }
   #endif
       }
   
  @@ -201,7 +203,7 @@
       new->scope = scope;
   
       if ((stat = create_lock(new, fname)) != APR_SUCCESS)
  -        return APR_SUCCESS;
  +        return stat;
   
       *lock = new;
       return APR_SUCCESS;