aboutsummaryrefslogtreecommitdiff
path: root/sshfs.c
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2019-11-27 09:42:30 +0000
committerNikolaus Rath <Nikolaus@rath.org>2019-11-27 09:42:30 +0000
commit28c22270f8b2bd1d65245d0417ec941a1dd6b1ec (patch)
treee6877f21d259577135c9c2911dd0b84a4fe64422 /sshfs.c
parent8822b60d9dbd9907065e7999f616b11ddce6d584 (diff)
downloadsshfs-28c22270f8b2bd1d65245d0417ec941a1dd6b1ec.tar
sshfs-28c22270f8b2bd1d65245d0417ec941a1dd6b1ec.tar.gz
sshfs-28c22270f8b2bd1d65245d0417ec941a1dd6b1ec.tar.bz2
sshfs-28c22270f8b2bd1d65245d0417ec941a1dd6b1ec.zip
Add missing mutex lock/unlocks when accessing conntab
(problem introduced in parent commit).
Diffstat (limited to 'sshfs.c')
-rw-r--r--sshfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sshfs.c b/sshfs.c
index 8cd89d3..b9602cb 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -2499,11 +2499,13 @@ static int sshfs_rename(const char *from, const char *to, unsigned int flags)
err = -EXDEV;
if (!err && sshfs.max_conns > 1) {
+ pthread_mutex_lock(&sshfs.lock);
void *conn = g_hash_table_lookup(sshfs.conntab, from);
if (conn != NULL) {
g_hash_table_replace(sshfs.conntab, g_strdup(to), conn);
g_hash_table_remove(sshfs.conntab, from);
}
+ pthread_mutex_unlock(&sshfs.lock);
}
return err;
@@ -2849,6 +2851,7 @@ static int sshfs_release(const char *path, struct fuse_file_info *fi)
buf_free(handle);
chunk_put_locked(sf->readahead);
if (sshfs.max_conns > 1) {
+ pthread_mutex_lock(&sshfs.lock);
sf->conn->file_count--;
if(!sf->conn->file_count)
g_hash_table_remove(sshfs.conntab, path);