apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r558403 - /apr/apr-util/trunk/dbm/sdbm/sdbm_lock.c
Date Sun, 22 Jul 2007 00:14:06 GMT
Author: davi
Date: Sat Jul 21 17:14:05 2007
New Revision: 558403

URL: http://svn.apache.org/viewvc?view=rev&rev=558403
Log:
Use the APR_FLOCK_TYPEMASK mask to extract the lock type (shared or exclusive)
while still preserving the other bits. This change allows the APR_FLOCK_NONBLOCK
flag to be passed to apr_file_lock().

PR: 28718

Modified:
    apr/apr-util/trunk/dbm/sdbm/sdbm_lock.c

Modified: apr/apr-util/trunk/dbm/sdbm/sdbm_lock.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbm/sdbm/sdbm_lock.c?view=diff&rev=558403&r1=558402&r2=558403
==============================================================================
--- apr/apr-util/trunk/dbm/sdbm/sdbm_lock.c (original)
+++ apr/apr-util/trunk/dbm/sdbm/sdbm_lock.c Sat Jul 21 17:14:05 2007
@@ -21,12 +21,13 @@
 #include "sdbm_private.h"
 #include "sdbm_tune.h"
 
-/* NOTE: this function blocks until it acquires the lock */
+/* NOTE: this function may block until it acquires the lock */
 APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type)
 {
     apr_status_t status;
+    int lock_type = type & APR_FLOCK_TYPEMASK;
 
-    if (!(type == APR_FLOCK_SHARED || type == APR_FLOCK_EXCLUSIVE))
+    if (!(lock_type == APR_FLOCK_SHARED || lock_type == APR_FLOCK_EXCLUSIVE))
         return APR_EINVAL;
 
     if (db->flags & SDBM_EXCLUSIVE_LOCK) {



Mime
View raw message