summaryrefslogtreecommitdiffstats
path: root/modules/dav/fs/lock.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2009-11-10 17:32:57 +0100
committerStefan Fritsch <sf@apache.org>2009-11-10 17:32:57 +0100
commitaa875cfd7f81951f29c35574e949955ef983ba0e (patch)
tree4f5dad40dceca42602474eb9905984333eb31cc1 /modules/dav/fs/lock.c
parentfix off by one error (diff)
downloadapache2-aa875cfd7f81951f29c35574e949955ef983ba0e.tar.xz
apache2-aa875cfd7f81951f29c35574e949955ef983ba0e.zip
Revert removal of the key_type byte in the lock key. There is no need to break
the format on systems without inodes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@834533 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/dav/fs/lock.c')
-rw-r--r--modules/dav/fs/lock.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/modules/dav/fs/lock.c b/modules/dav/fs/lock.c
index 97aa7eab45..41dc5ed9e6 100644
--- a/modules/dav/fs/lock.c
+++ b/modules/dav/fs/lock.c
@@ -48,7 +48,8 @@
**
** KEY
**
-** The database is keyed by the full path.
+** The database is keyed by a key_type unsigned char (DAV_TYPE_FNAME)
+** followed by the full path. The key_type DAV_TYPE_INODE is not used anymore.
**
** VALUE
**
@@ -80,6 +81,12 @@
#define DAV_LOCK_DIRECT 1
#define DAV_LOCK_INDIRECT 2
+/*
+ * not used anymore
+ * #define DAV_TYPE_INODE 10
+ */
+#define DAV_TYPE_FNAME 11
+
/* ack. forward declare. */
static dav_error * dav_fs_remove_locknull_member(apr_pool_t *p,
@@ -379,8 +386,11 @@ static apr_datum_t dav_fs_build_key(apr_pool_t *p,
/* ### does this allocation have a proper lifetime? need to check */
/* ### can we use a buffer for this? */
- key.dsize = strlen(pathname) + 1;
- key.dptr = apr_pstrmemdup(p, pathname, key.dsize - 1);
+ /* size is TYPE + pathname + null */
+ key.dsize = strlen(pathname) + 2;
+ key.dptr = apr_palloc(p, key.dsize);
+ *key.dptr = DAV_TYPE_FNAME;
+ memcpy(key.dptr + 1, pathname, key.dsize - 1);
if (key.dptr[key.dsize - 2] == '/')
key.dptr[--key.dsize - 1] = '\0';
return key;
@@ -579,14 +589,15 @@ static dav_error * dav_fs_load_lock_record(dav_lockdb *lockdb, apr_datum_t key,
need_save = DAV_TRUE;
/* Remove timed-out locknull fm .locknull list */
- {
+ if (*key.dptr == DAV_TYPE_FNAME) {
+ const char *fname = key.dptr + 1;
apr_finfo_t finfo;
apr_status_t rv;
/* if we don't see the file, then it's a locknull */
- rv = apr_stat(&finfo, key.dptr, APR_FINFO_MIN | APR_FINFO_LINK, p);
+ rv = apr_stat(&finfo, fname, APR_FINFO_MIN | APR_FINFO_LINK, p);
if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) {
- if ((err = dav_fs_remove_locknull_member(p, key.dptr, &buf)) != NULL) {
+ if ((err = dav_fs_remove_locknull_member(p, fname, &buf)) != NULL) {
/* ### push a higher-level description? */
return err;
}