btrfs-progs: fi resize: fix return value check_resize_args()
PATCH 1/1 btrfs-progs: fi resize: fix return value check_resize_args()
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.
--- cmds/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmds/filesystem.c +1 -1
@@ -1203,7 +1203,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
Quoted 5 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.Signed-off-by Sidong Yang <[email protected]>
Added to devel, thanks.
Hi,
Quoted 14 lines
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.Signed-off-by Sidong Yang <[email protected]>--- cmds/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)cmds/filesystem.c +0
-0
cmds/filesystem.c static int check_resize_args(const char *amount, const char *path) { · line 1209
Quoted 8 lines
cmds/filesystem.c +1
-1@@ -1203,7 +1203,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,
This patch will make 'btrfs filesystem resize' always fail, and then break fstests btrfs/177.
# df -h /mnt/scratch/ Filesystem Size Used Avail Use% Mounted on /dev/sdb2 1.0G 3.4M 927M 1% /mnt/scratch
# btrfs filesystem resize 3G /mnt/scratch/ Resize device id 1 (/dev/sdb2) from 3.00GiB to 3.00GiB # echo $? 1
# df -h /mnt/scratch/ Filesystem Size Used Avail Use% Mounted on /dev/sdb2 1.0G 3.4M 927M 1% /mnt/scratch
'ret' is set to 2 here.
ret = snprintf(amount_dup, BTRFS_VOL_NAME_MAX, "%s", amount);
if (strlen(amount) != ret) {
error("newsize argument is too long");
ret = 1;
goto out;
}Best Regards
Wang Yugui ([email protected])
2022/09/12
Quoted 23 lines · Wang Yugui
Hi,
Quoted 21 lines
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.Signed-off-by Sidong Yang <[email protected]>--- cmds/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)cmds/filesystem.c +1
-1@@ -1203,7 +1203,7 @@ static int check_resize_args(const char *amount, const char *path) { out:free (di_args); -return 0 ; +return ret; }
Quoted 4 lines
cmds/filesystem.c static int check_resize_args(const char *amount, const char *path) { · line 1209
Quoted 1 line
cmds/filesystem.c +0
-0static int cmd_filesystem_resize(const struct cmd_struct *cmd,This patch will make 'btrfs filesystem resize' always fail, and then break fstests btrfs/177.
I noticed that too when doing the progs release so the patch will be dropped.