aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/passthrough.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/example/passthrough.c b/example/passthrough.c
index 55f7704..67663ab 100644
--- a/example/passthrough.c
+++ b/example/passthrough.c
@@ -250,10 +250,12 @@ static int xmp_chown(const char *path, uid_t uid, gid_t gid,
static int xmp_truncate(const char *path, off_t size,
struct fuse_file_info *fi)
{
- (void) fi;
int res;
- res = truncate(path, size);
+ if (fi != NULL)
+ res = ftruncate(fi->fh, size);
+ else
+ res = truncate(path, size);
if (res == -1)
return -errno;