Skip to contentSkip to conversation

btrfs-progs: cmds: resize: fix check_resize_args() return value

PATCH In review Sidong Yang 2 participants 2 messages Oct 16, 2022 – Oct 18, 2022 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: cmds: resize: fix check_resize_args() return value

check_resize_args() function checks user argument amount and should returns it's validity. But now the code returns only zero. This patch make it correct to return ret. It also needs to set to zero after checking argument length.

---
 cmds/filesystem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmds/filesystem.c +2 -1
index 7c8323d9..ecd5cd8f 100644
@@ -1122,6 +1122,7 @@ static int check_resize_args(const char *amount, const char *path) {
 		ret = 1;
 		goto out;
 	}
+	ret = 0;
 
 	sizestr = amount_dup;
 	devstr = strchr(sizestr, ':');
@@ -1208,7 +1209,7 @@ static int check_resize_args(const char *amount, const char *path) {
 
 out:
 	free(di_args);
-	return 0;
+	return ret;
 }
 
 static int cmd_filesystem_resize(const struct cmd_struct *cmd,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Sidong Yang

check_resize_args() function checks user argument amount and should returns it's validity. But now the code returns only zero. This patch make it correct to return ret. It also needs to set to zero after checking argument length.

Added to devel, thanks.