aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--lib/fuse.c14
2 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a498dae..22ec349 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,9 @@
* Add ctx->pid to debug output
+ * Fix st_nlink value in high level lib if file is unlinked but
+ still open
+
2010-10-14 Miklos Szeredi <miklos@szeredi.hu>
* Use LTLIBICONV when linking libfuse. This fixes building against
diff --git a/lib/fuse.c b/lib/fuse.c
index c64e596..3793233 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -2075,11 +2075,15 @@ static void fuse_lib_getattr(fuse_req_t req, fuse_ino_t ino,
free_path(f, ino, path);
}
if (!err) {
- if (f->conf.auto_cache) {
- pthread_mutex_lock(&f->lock);
- update_stat(get_node(f, ino), &buf);
- pthread_mutex_unlock(&f->lock);
- }
+ struct node *node;
+
+ pthread_mutex_lock(&f->lock);
+ node = get_node(f, ino);
+ if (node->is_hidden && buf.st_nlink > 0)
+ buf.st_nlink--;
+ if (f->conf.auto_cache)
+ update_stat(node, &buf);
+ pthread_mutex_unlock(&f->lock);
set_stat(f, ino, &buf);
fuse_reply_attr(req, &buf, f->conf.attr_timeout);
} else