[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] locks fix in BDB

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Tue, 20 Sep 2011 16:25:09 +0300

Does this look correct? locks-test and lock_tests.py both pass.

[[[
* subversion/libsvn_fs_base/bdb/locks-table.c
  (svn_fs_bdb__locks_get):
    Set LOOKUP_PATH before constructing BDB's KEY from it.
]]]

[[[
Index: subversion/libsvn_fs_base/bdb/locks-table.c
===================================================================
--- subversion/libsvn_fs_base/bdb/locks-table.c (revision 1173129)
+++ subversion/libsvn_fs_base/bdb/locks-table.c (working copy)
@@ -206,7 +206,7 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
   const char *lock_token;
   svn_lock_t *lock;
   svn_error_t *err;
- const char *lookup_path = path;
+ const char *lookup_path;
 
   /* First, try to lookup PATH itself. */
   err = svn_fs_bdb__lock_token_get(&lock_token, fs, path, trail, pool);
@@ -238,6 +238,11 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
                                     &cursor, 0);
   SVN_ERR(BDB_WRAP(fs, "creating cursor for reading lock tokens", db_err));
 
+ if (!svn_fspath__is_root(path, strlen(path)))
+ lookup_path = apr_pstrcat(pool, path, "/", (char *)NULL);
+ else
+ lookup_path = path;
+
   /* Since the key is going to be returned as well as the value make
      sure BDB malloc's the returned key. */
   svn_fs_base__str_to_dbt(&key, lookup_path);
@@ -247,9 +252,6 @@ svn_fs_bdb__locks_get(svn_fs_t *fs,
      the one passed in, by passing in the DB_RANGE_SET flag. */
   db_err = svn_bdb_dbc_get(cursor, &key, svn_fs_base__result_dbt(&value),
                            DB_SET_RANGE);
-
- if (!svn_fspath__is_root(path, strlen(path)))
- lookup_path = apr_pstrcat(pool, path, "/", (char *)NULL);
 
   /* As long as the prefix of the returned KEY matches LOOKUP_PATH we
      know it is either LOOKUP_PATH or a decendant thereof. */
]]]
Received on 2011-09-20 15:26:03 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.