From e7774d8fef39d16eb96f1e55cf2f33d3acb14d88 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Sun, 6 Jul 2025 11:32:50 -0700 Subject: [PATCH] fuse2fs: don't try to mount after option parsing errors Actually check the outcome of parsing CLI options before trying to mount. Signed-off-by: Darrick J. Wong Link: https://lore.kernel.org/r/175182663113.1984706.10460295274868313866.stgit@frogsfrogsfrogs Signed-off-by: Theodore Ts'o --- misc/fuse2fs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index ff8aa023..ab3efea6 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -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]); -- 2.47.2