aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-22 13:46:14 +0200
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2017-08-22 14:00:44 +0200
commitf88a285cf28b41064f0ed4c5a7e360c97059f942 (patch)
treea5fd7369c8ac98880a31e2d3ef9c24f65db88c7c /example
parente71bb4855732ae40310b58deded646b416de46cc (diff)
Make passthrough_fh work under FreeBSD.
Diffstat (limited to 'example')
-rw-r--r--example/passthrough_fh.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/example/passthrough_fh.c b/example/passthrough_fh.c
index 909422a..2b1ed1c 100644
--- a/example/passthrough_fh.c
+++ b/example/passthrough_fh.c
@@ -151,7 +151,13 @@ static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
(void) path;
if (offset != d->offset) {
+#ifndef __FreeBSD__
seekdir(d->dp, offset);
+#else
+ /* Subtract the one that we add when calling
+ telldir() below */
+ seekdir(d->dp, offset-1);
+#endif
d->entry = NULL;
d->offset = offset;
}
@@ -181,6 +187,13 @@ static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
st.st_mode = d->entry->d_type << 12;
}
nextoff = telldir(d->dp);
+#ifdef __FreeBSD__
+ /* Under FreeBSD, telldir() may return 0 the first time
+ it is called. But for libfuse, an offset of zero
+ means that offsets are not supported, so we shift
+ everything by one. */
+ nextoff++;
+#endif
if (filler(buf, d->entry->d_name, &st, nextoff, fill_flags))
break;