aboutsummaryrefslogtreecommitdiffstats
path: root/plpfuse
diff options
context:
space:
mode:
Diffstat (limited to 'plpfuse')
-rw-r--r--plpfuse/main.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/plpfuse/main.cc b/plpfuse/main.cc
index 8689cae..769577c 100644
--- a/plpfuse/main.cc
+++ b/plpfuse/main.cc
@@ -320,13 +320,15 @@ int fuse(int argc, char *argv[])
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
struct fuse_chan *ch;
char *mountpoint;
- int err = -1;
+ int err = -1, foreground;
- if (fuse_parse_cmdline(&args, &mountpoint, NULL, NULL) != -1 &&
+ if (fuse_parse_cmdline(&args, &mountpoint, NULL, &foreground) != -1 &&
(ch = fuse_mount(mountpoint, &args)) != NULL) {
- struct fuse *fp = fuse_new(ch, &args, &plp_oper, sizeof(plp_oper), NULL);
- if (fp != NULL)
- err = fuse_loop(fp);
+ if (fuse_daemonize(foreground) != -1) {
+ struct fuse *fp = fuse_new(ch, &args, &plp_oper, sizeof(plp_oper), NULL);
+ if (fp != NULL)
+ err = fuse_loop(fp);
+ }
fuse_unmount(mountpoint, ch);
}
fuse_opt_free_args(&args);