aboutsummaryrefslogtreecommitdiff
path: root/cache.c
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2007-04-18 10:24:10 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2007-04-18 10:24:10 +0000
commiteff16314282d683e0b6f6e8abfc0f51091eebce2 (patch)
tree0080bef3bf0e28c07d7ce6e9c38530c0a14b1fae /cache.c
parent4399cfca84e9250aec1d78a2719857c054631a63 (diff)
downloadsshfs-eff16314282d683e0b6f6e8abfc0f51091eebce2.tar
sshfs-eff16314282d683e0b6f6e8abfc0f51091eebce2.tar.gz
sshfs-eff16314282d683e0b6f6e8abfc0f51091eebce2.tar.bz2
sshfs-eff16314282d683e0b6f6e8abfc0f51091eebce2.zip
Fix spurious cache entries remaining after renaming a directory
Diffstat (limited to 'cache.c')
-rw-r--r--cache.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/cache.c b/cache.c
index d17e735..ab378a3 100644
--- a/cache.c
+++ b/cache.c
@@ -116,9 +116,20 @@ static void cache_invalidate_dir(const char *path)
pthread_mutex_unlock(&cache.lock);
}
+static int cache_del_children(const char *key, void *val_, const char *path)
+{
+ (void) val_;
+ if (strncmp(key, path, strlen(path)) == 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
static void cache_do_rename(const char *from, const char *to)
{
pthread_mutex_lock(&cache.lock);
+ g_hash_table_foreach_remove(cache.table, (GHRFunc) cache_del_children,
+ (char *) from);
cache_purge(from);
cache_purge(to);
cache_purge_parent(from);