diff mbox series

[8/8] fuse2fs: don't try to mount after option parsing errors

Message ID 175182663113.1984706.10460295274868313866.stgit@frogsfrogsfrogs
State Accepted
Headers show
Series [1/8] libext2fs: fix off-by-one bug in punch_extent_blocks | expand

Commit Message

Darrick J. Wong July 6, 2025, 6:32 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Actually check the outcome of parsing CLI options before trying to
mount.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 misc/fuse2fs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index ff8aa023d1c555..ab3efea66d3def 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]);