diff options
author | Anand Jain <anand.jain@oracle.com> | 2015-08-28 22:11:30 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2015-10-02 17:54:29 +0200 |
commit | 54fdddfdc14fa6e9ddf6960cb22d668d83cdf65e (patch) | |
tree | d34a2b250561bb48239b54debce8717efe89ac9a /cmds-device.c | |
parent | 5e561cef1d51e6fc6b52460f70b9bca5d4b3ed03 (diff) |
btrfs-progs: fix is_block_device() return checks
it was highlighted to me is_block_device(), returns
1 if the file is a block device,
< 0 in case of an error (eg: file not found)
0 otherwise
This patch makes proper return checks at all the places
where is_block_device() is used. Thanks to Goffredo.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Suggested-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r-- | cmds-device.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmds-device.c b/cmds-device.c index 2bb6bcb1..5f2b952a 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -163,7 +163,7 @@ static int _cmd_device_remove(int argc, char **argv, struct btrfs_ioctl_vol_args arg; int res; - if (!is_block_device(argv[i])) { + if (is_block_device(argv[i]) != 1) { fprintf(stderr, "ERROR: %s is not a block device\n", argv[i]); ret++; @@ -264,7 +264,7 @@ static int cmd_device_scan(int argc, char **argv) for( i = devstart ; i < argc ; i++ ){ char *path; - if (!is_block_device(argv[i])) { + if (is_block_device(argv[i]) != 1) { fprintf(stderr, "ERROR: %s is not a block device\n", argv[i]); ret = 1; @@ -323,7 +323,7 @@ static int cmd_device_ready(int argc, char **argv) goto out; } - if (!is_block_device(path)) { + if (is_block_device(path) != 1) { fprintf(stderr, "ERROR: %s is not a block device\n", path); ret = 1; |