Btrfs-progs: fix magic return value in cmds-chunk.c

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Wang Shilong 2013-09-04 23:22:20 +08:00 committed by Chris Mason
parent 2f041d9915
commit a74e3b4145

View File

@ -794,13 +794,15 @@ static int scan_devices(struct recover_control *rc)
int ret = 0; int ret = 0;
int fd; int fd;
struct btrfs_device *dev; struct btrfs_device *dev;
int e;
list_for_each_entry(dev, &rc->fs_devices->devices, dev_list) { list_for_each_entry(dev, &rc->fs_devices->devices, dev_list) {
fd = open(dev->name, O_RDONLY); fd = open(dev->name, O_RDONLY);
if (fd < 0) { if (fd < 0) {
e = errno;
fprintf(stderr, "Failed to open device %s\n", fprintf(stderr, "Failed to open device %s\n",
dev->name); dev->name);
return -1; return -e;
} }
ret = scan_one_device(rc, fd, dev); ret = scan_one_device(rc, fd, dev);
close(fd); close(fd);
@ -1785,7 +1787,7 @@ int cmd_chunk_recover(int argc, char *argv[])
ret = check_mounted(file); ret = check_mounted(file);
if (ret) { if (ret) {
fprintf(stderr, "the device is busy\n"); fprintf(stderr, "the device is busy\n");
return ret; goto out;
} }
ret = btrfs_recover_chunk_tree(file, verbose, yes); ret = btrfs_recover_chunk_tree(file, verbose, yes);
@ -1797,5 +1799,6 @@ int cmd_chunk_recover(int argc, char *argv[])
} else { } else {
fprintf(stdout, "Fail to recover the chunk tree.\n"); fprintf(stdout, "Fail to recover the chunk tree.\n");
} }
return ret; out:
return !!ret;
} }