diff options
Diffstat (limited to 'example/hello_ll.c')
-rw-r--r-- | example/hello_ll.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/example/hello_ll.c b/example/hello_ll.c index 531d1c9..dbe141c 100644 --- a/example/hello_ll.c +++ b/example/hello_ll.c @@ -149,33 +149,27 @@ static struct fuse_lowlevel_ops hello_ll_oper = { int main(int argc, char *argv[]) { struct fuse_args args = FUSE_ARGS_INIT(argc, argv); + struct fuse_chan *ch; char *mountpoint; int err = -1; - int fd = -1; if (fuse_parse_cmdline(&args, &mountpoint, NULL, NULL) != -1 && - (fd = fuse_mount(mountpoint, &args)) != -1) { + (ch = fuse_mount(mountpoint, &args)) != NULL) { struct fuse_session *se; se = fuse_lowlevel_new(&args, &hello_ll_oper, sizeof(hello_ll_oper), NULL); if (se != NULL) { if (fuse_set_signal_handlers(se) != -1) { - struct fuse_chan *ch = fuse_kern_chan_new(fd); - if (ch != NULL) { - fuse_session_add_chan(se, ch); - err = fuse_session_loop(se); - } + fuse_session_add_chan(se, ch); + err = fuse_session_loop(se); fuse_remove_signal_handlers(se); + fuse_session_remove_chan(ch); } - fuse_unmount(mountpoint, fd); fuse_session_destroy(se); - goto out; } - close(fd); + fuse_unmount(mountpoint, ch); } - fuse_unmount(mountpoint, fd); -out: fuse_opt_free_args(&args); return err ? 1 : 0; |