From c08071e7be46a912941002f507323aa2c0ed25fb Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 26 Oct 2023 00:18:43 +0200 Subject: [PATCH] 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 55438f3930b23f ("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 4286eb552ed388 ("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 --- cmds/filesystem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 813cfc91..1b444b8f 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -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,