btrfs-progs: resize: properly return error from check_resize_args

The function almost always returns 0 even for errors as the ret value is
not used in the final return. This was attempted to be fixed in
55438f3930 ("btrfs-progs: resize: return error value from
check_resize_args()") but this broke 'resize cancel' when devid 1 was
missing and was later reverted as 4286eb552e ("Revert "btrfs-progs:
resize: return error value from check_resize_args()"").

The devid fallback has been fixed so the proper return value can be
returned now.

Issue: #539
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-10-26 00:18:43 +02:00
parent b64f8437b6
commit c08071e7be

View File

@ -1242,6 +1242,7 @@ static int check_resize_args(const char *amount, const char *path, u64 *devid_re
ret = 1;
goto out;
}
ret = 0;
/* Cancel does not need to determine the device number. */
if (strcmp(amount, "cancel") == 0) {
@ -1351,7 +1352,7 @@ static int check_resize_args(const char *amount, const char *path, u64 *devid_re
out:
free(di_args);
return 0;
return ret;
}
static int cmd_filesystem_resize(const struct cmd_struct *cmd,