return different non-zero error codes (#290)
authorOded Arbel <oded@geek.co.il>
Wed, 29 Aug 2018 16:20:56 +0000 (19:20 +0300)
committerNikolaus Rath <Nikolaus@rath.org>
Wed, 29 Aug 2018 16:20:56 +0000 (17:20 +0100)
Return different error codes from fuse_main()

include/fuse.h
lib/helper.c

index 740119d150d8ce14a1748ee1096e1750f5dfa7ae..7b63c4211be94dfdb8ce3b453a82f86dbe1eaa56 100644 (file)
@@ -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
index 4e82692455d6578ad7e79612aeabee26d48e1681..07cef8177c5269f09b3f75a9c2675e005eadef87 100644 (file)
@@ -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: