From 0747d9f6f108aee1eeebde0e2ad2e3ba0c2f400c Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Sat, 15 Dec 2007 16:31:26 +0000 Subject: Make plpfuse daemonize if -f not given. --- plpfuse/main.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'plpfuse') 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); -- cgit v1.2.3