]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: don't try to mount after option parsing errors
authorDarrick J. Wong <djwong@kernel.org>
Sun, 6 Jul 2025 18:32:50 +0000 (11:32 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 31 Jul 2025 14:41:55 +0000 (10:41 -0400)
Actually check the outcome of parsing CLI options before trying to
mount.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/175182663113.1984706.10460295274868313866.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/fuse2fs.c

index ff8aa023d1c5555a4e19689d8232a8b151ace46e..ab3efea66d3def64010922bb91119e2d8bde1fc7 100644 (file)
@@ -4407,14 +4407,16 @@ int main(int argc, char *argv[])
        FILE *orig_stderr = stderr;
        char *logfile;
        char extra_args[BUFSIZ];
-       int ret = 0;
+       int ret;
        int flags = EXT2_FLAG_64BITS | EXT2_FLAG_THREADS | EXT2_FLAG_EXCLUSIVE |
                    EXT2_FLAG_RW;
 
        memset(&fctx, 0, sizeof(fctx));
        fctx.magic = FUSE2FS_MAGIC;
 
-       fuse_opt_parse(&args, &fctx, fuse2fs_opts, fuse2fs_opt_proc);
+       ret = fuse_opt_parse(&args, &fctx, fuse2fs_opts, fuse2fs_opt_proc);
+       if (ret)
+               exit(1);
        if (fctx.device == NULL) {
                fprintf(stderr, "Missing ext4 device/image\n");
                fprintf(stderr, "See '%s -h' for usage\n", argv[0]);