summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Siegl <stesie@brokenpipe.de>2006-08-04 00:45:35 +0000
committerStefan Siegl <stesie@brokenpipe.de>2006-08-04 00:45:35 +0000
commit2c6df679a905af1e2ac627138078a7069ada5c76 (patch)
tree90fb850beba6c40dfc070b584b2497a87b448eed
parentea03092a6c07eaeeb456a1ed845ebf62d81ec314 (diff)
added -f switch, to force foreground operation, unless started using settrans
-rw-r--r--src/fuse_i.h3
-rw-r--r--src/main.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/fuse_i.h b/src/fuse_i.h
index 85e320b1a..16589129b 100644
--- a/src/fuse_i.h
+++ b/src/fuse_i.h
@@ -123,6 +123,9 @@ struct _libfuse_params {
/* whether to disable multithreading (if using fuse_main) */
unsigned disable_mt : 1;
+ /* whether to fork to background or not (if started without settrans) */
+ unsigned foreground : 1;
+
/* the uid and gid to set and which umask to apply (if bitfields are set) */
uid_t uid;
gid_t gid;
diff --git a/src/main.c b/src/main.c
index cbb54832f..bdaade9c4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -159,7 +159,7 @@ fuse_parse_argv(int argc, char *argv[])
int opt;
FILE *opt_help = NULL;
- while((opt = getopt(argc, argv, "d::o:hs")) >= 0)
+ while((opt = getopt(argc, argv, "d::o:hsf")) >= 0)
switch(opt)
{
case 'd':
@@ -186,6 +186,10 @@ fuse_parse_argv(int argc, char *argv[])
libfuse_params.disable_mt = 1;
break;
+ case 'f':
+ libfuse_params.foreground = 1;
+ break;
+
case '?':
default:
opt_help = stderr;
@@ -206,6 +210,7 @@ fuse_parse_argv(int argc, char *argv[])
" -d[FILENAME] "
"enable debug output (default=stderr)\n"
" -s disable multi-threaded operation\n"
+ " -f don't fork to background\n"
/* " -r "
* "mount read only (equivalent to '-o ro')\n" */
" -o opt,[opt...] mount options\n"
@@ -365,7 +370,7 @@ fuse_mount_compat22(const char *mountpoint, const char *opts)
error(10, 0, "Unable to access underlying node");
/* fork first, we are expected to act from the background */
- pid_t pid = fork();
+ pid_t pid = libfuse_params.foreground ? 0 : fork();
if(pid < 0)
{
perror(PACKAGE ": failed to fork to background");