From: Nikolaus Rath Date: Fri, 7 Apr 2017 23:27:33 +0000 (-0700) Subject: example/passthrough: close open files in release() X-Git-Tag: fuse-3.0.1~10 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=db1c6adb18950c188fbf20247245eef11ad47b30;p=qemu-gpiodev%2Flibfuse.git example/passthrough: close open files in release() That way we can use the file descriptor for other operations. --- diff --git a/example/passthrough.c b/example/passthrough.c index 22e7083..55f7704 100644 --- a/example/passthrough.c +++ b/example/passthrough.c @@ -284,7 +284,7 @@ static int xmp_open(const char *path, struct fuse_file_info *fi) if (res == -1) return -errno; - close(res); + fi->fh = res; return 0; } @@ -339,11 +339,8 @@ static int xmp_statfs(const char *path, struct statvfs *stbuf) static int xmp_release(const char *path, struct fuse_file_info *fi) { - /* Just a stub. This method is optional and can safely be left - unimplemented */ - (void) path; - (void) fi; + close(fi->fh); return 0; }