summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-06-04 20:53:28 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-06-04 20:53:28 +0000
commitc15b6281349ec13718e6ac5f459a7ab4758c0feb (patch)
tree30d65bffc9bb68df6933f38e0e1ae94924f3dd64
parent4f668fb84327395e8792df2f7f68b4b0aa2db908 (diff)
fix readdir, from sylvestre
-rw-r--r--lib/libfuse/fuse.h3
-rw-r--r--lib/libfuse/fuse_ops.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/libfuse/fuse.h b/lib/libfuse/fuse.h
index 7cd0fe7ad03..e379e624824 100644
--- a/lib/libfuse/fuse.h
+++ b/lib/libfuse/fuse.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse.h,v 1.2 2013/06/03 16:21:08 tedu Exp $ */
+/* $OpenBSD: fuse.h,v 1.3 2013/06/04 20:53:26 tedu Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -67,6 +67,7 @@ typedef struct fuse_dirhandle {
uint32_t size;
uint32_t start;
uint32_t idx;
+ off_t off;
} *fuse_dirh_t;
typedef int (*fuse_dirfil_t)(fuse_dirh_t, const char *, int, ino_t);
diff --git a/lib/libfuse/fuse_ops.c b/lib/libfuse/fuse_ops.c
index b6c6df42adc..27373dbd2e5 100644
--- a/lib/libfuse/fuse_ops.c
+++ b/lib/libfuse/fuse_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_ops.c,v 1.2 2013/06/03 16:21:08 tedu Exp $ */
+/* $OpenBSD: fuse_ops.c,v 1.3 2013/06/04 20:53:27 tedu Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -223,7 +223,8 @@ ifuse_fill_readdir(void *dh, const char *name, const struct stat *stbuf,
namelen = strnlen(name, MAXNAMLEN);
len = GENERIC_DIRSIZ(namelen);
- if (fd->full || fbdatsize(fbuf) + len > fd->size) {
+ if ((fd->full || fbdatsize(fbuf) + len > fd->size) ||
+ (!fd->isgetdir && fd->off != off)) {
fd->full = 1;
return (0);
}
@@ -235,7 +236,7 @@ ifuse_fill_readdir(void *dh, const char *name, const struct stat *stbuf,
dir = (struct dirent *) &fbuf->fb_dat[fbdatsize(fbuf)];
- if (!off)
+ if (off)
fd->filled = 0;
if (stbuf) {
@@ -305,6 +306,7 @@ ifuse_ops_readdir(struct fuse *f, struct fusebuf *fbuf)
vn->fd->full = 0;
vn->fd->isgetdir = 0;
vn->fd->size = size;
+ vn->fd->off = offset;
realname = build_realname(f, vn->ino);
if (f->op.readdir)