btrfs-progs: dev replace: check for no result before using results

Userspace understands the ioctl BTRFS_IOC_DEV_REPLACE command status
using the struct btrfs_ioctl_dev_replace_args::result, and so userspace
initializes this to BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT, so exclude
this value in checking for the error.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2019-01-31 18:05:40 +08:00 committed by David Sterba
parent 3ef4bd5cb8
commit f79fb2cf3e
1 changed files with 2 additions and 2 deletions

View File

@ -295,8 +295,8 @@ static int cmd_replace_start(int argc, char **argv)
goto leave_with_error; goto leave_with_error;
} }
if (start_args.result != if (start_args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT &&
BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) { start_args.result != BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR) {
error("ioctl(DEV_REPLACE_START) on '%s' returns error: %s", error("ioctl(DEV_REPLACE_START) on '%s' returns error: %s",
path, path,
replace_dev_result2string(start_args.result)); replace_dev_result2string(start_args.result));