aboutsummaryrefslogtreecommitdiff
path: root/lib/fuse.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2015-02-26 17:12:30 +0100
committerGravatar Miklos Szeredi <mszeredi@suse.cz>2015-02-26 17:12:30 +0100
commit0ecd21258e24fec185c157520435783780a1ad8f (patch)
tree5a2c8bd09c01d701420a47190fa4df7b394faec5 /lib/fuse.c
parentf2f4d1c312784a5909bb931cc8d68287c8c81326 (diff)
libfuse: fix handling of '.' and '..' in highlevel readdirplus
Diffstat (limited to 'lib/fuse.c')
-rw-r--r--lib/fuse.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/fuse.c b/lib/fuse.c
index 75d657c..2f1c85e 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -3418,6 +3418,12 @@ static int fill_dir(void *dh_, const char *name, const struct stat *statp,
return 0;
}
+static int is_dot_or_dotdot(const char *name)
+{
+ return name[0] == '.' && (name[1] == '\0' ||
+ (name[1] == '.' && name[2] == '\0'));
+}
+
static int fill_dir_plus(void *dh_, const char *name, const struct stat *statp,
off_t off, enum fuse_fill_dir_flags flags)
{
@@ -3437,10 +3443,12 @@ static int fill_dir_plus(void *dh_, const char *name, const struct stat *statp,
if (off && statp && (flags & FUSE_FILL_DIR_PLUS)) {
e.attr = *statp;
- res = do_lookup(f, dh->nodeid, name, &e);
- if (res) {
- dh->error = res;
- return 1;
+ if (!is_dot_or_dotdot(name)) {
+ res = do_lookup(f, dh->nodeid, name, &e);
+ if (res) {
+ dh->error = res;
+ return 1;
+ }
}
} else {
e.attr.st_ino = FUSE_UNKNOWN_INO;