diff options
author | davi <davi@13f79535-47bb-0310-9956-ffa450edef68> | 2007-07-22 00:14:05 +0000 |
---|---|---|
committer | davi <davi@13f79535-47bb-0310-9956-ffa450edef68> | 2007-07-22 00:14:05 +0000 |
commit | f04154e93b46878924080e69023abfabd10e14b6 (patch) | |
tree | ad1c8d8f4064efdd800c9415ece847d9b2157719 /dbm | |
parent | dec4c8975ee519c8218447f950605e641e55630a (diff) | |
download | libapr-util-f04154e93b46878924080e69023abfabd10e14b6.tar.gz |
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
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@558403 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dbm')
-rw-r--r-- | dbm/sdbm/sdbm_lock.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dbm/sdbm/sdbm_lock.c b/dbm/sdbm/sdbm_lock.c index b2a30112..7d62ffd6 100644 --- a/dbm/sdbm/sdbm_lock.c +++ b/dbm/sdbm/sdbm_lock.c @@ -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) { |