aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOded Arbel <oded@geek.co.il>2018-08-29 19:20:56 +0300
committerNikolaus Rath <Nikolaus@rath.org>2018-08-29 17:20:56 +0100
commit8198eb4b6fcf31b15984a9cd0f1d00695d3b9d91 (patch)
tree3057612000ac077b33181af837d73cf39c95a81a
parent82ee6d6f77a2e386e42714d6ab56b39fcb00488e (diff)
downloadlibfuse-8198eb4b6fcf31b15984a9cd0f1d00695d3b9d91.tar.gz
return different non-zero error codes (#290)
Return different error codes from fuse_main()
-rw-r--r--include/fuse.h9
-rw-r--r--lib/helper.c12
2 files changed, 15 insertions, 6 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 740119d..7b63c42 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -812,6 +812,15 @@ struct fuse_context {
*
* Note: this is currently implemented as a macro.
*
+ * The following error codes may be returned from fuse_main():
+ * 1: Invalid option arguments
+ * 2: No mount point specified
+ * 3: FUSE setup failed
+ * 4: Mounting failed
+ * 5: Failed to daemonize (detach from session)
+ * 6: Failed to set up signal handlers
+ * 7: An error occured during the life of the file system
+ *
* @param argc the argument counter passed to the main() function
* @param argv the argument vector passed to the main() function
* @param op the file system operation
diff --git a/lib/helper.c b/lib/helper.c
index 4e82692..07cef81 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -303,30 +303,30 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
if (!opts.show_help &&
!opts.mountpoint) {
fprintf(stderr, "error: no mountpoint specified\n");
- res = 1;
+ res = 2;
goto out1;
}
fuse = fuse_new_31(&args, op, op_size, user_data);
if (fuse == NULL) {
- res = 1;
+ res = 3;
goto out1;
}
if (fuse_mount(fuse,opts.mountpoint) != 0) {
- res = 1;
+ res = 4;
goto out2;
}
if (fuse_daemonize(opts.foreground) != 0) {
- res = 1;
+ res = 5;
goto out3;
}
struct fuse_session *se = fuse_get_session(fuse);
if (fuse_set_signal_handlers(se) != 0) {
- res = 1;
+ res = 6;
goto out3;
}
@@ -339,7 +339,7 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
res = fuse_loop_mt_32(fuse, &loop_config);
}
if (res)
- res = 1;
+ res = 7;
fuse_remove_signal_handlers(se);
out3: