Skip to content

Commit

Permalink
Fix the notification pipe for squashfuse in case of failure
Browse files Browse the repository at this point in the history
The following scenario now correctly sends a failure notification to the
pipe:
```
$ mkfifo /tmp/notify_pipe
$ cat /tmp/notify_pipe
```
then run squashfuse:
```
$ ./squashfuse -o notify_pipe=/tmp/notify_pipe /dev/null /mnt
```
This fix only applies to squashfuse, squashfuse_ll was behaving as
expected.

Fixes #112
  • Loading branch information
ariel-miculas committed Sep 8, 2023
1 parent b0efb4a commit c4c8692
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hl.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,21 @@ int main(int argc, char *argv[]) {
}

hl = sqfs_hl_open(opts.image, opts.offset, opts.subdir);
if (!hl)
return -1;
if (!hl) {
ret = -1;
goto out;
}

hl->fs.notify_pipe = opts.notify_pipe;

fuse_opt_add_arg(&args, "-s"); /* single threaded */
ret = fuse_main(args.argc, args.argv, &sqfs_hl_ops, hl);
out:
if (ret) {
if (hl->fs.notify_pipe) {
notify_mount_ready(hl->fs.notify_pipe, NOTIFY_FAILURE);
if (opts.notify_pipe) {
notify_mount_ready(opts.notify_pipe, NOTIFY_FAILURE);
}
}
out:
fuse_opt_free_args(&args);
return ret;
}

0 comments on commit c4c8692

Please sign in to comment.