diff options
author | David Sterba <dsterba@suse.com> | 2016-01-12 13:35:50 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-01-12 15:02:55 +0100 |
commit | ac4ec4d4f44e67fc3d1fd806cf7acbe2485cedee (patch) | |
tree | 434f39155069a914bc76d3e9fdca87a331012b7a /cmds-fi-usage.c | |
parent | 633dc6f80f201afdf5b8524ae377187d58f0ef3b (diff) | |
download | btrfs-progs-ac4ec4d4f44e67fc3d1fd806cf7acbe2485cedee.tar.gz |
btrfs-progs: check for negative return value from ioctl
Handle only negative values returned by ioctl syscalls, with exception
of the device remove. It returns positive values that are handled later.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-fi-usage.c')
-rw-r--r-- | cmds-fi-usage.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index 356ed04..c91c2ca 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -240,7 +240,7 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path) sargs->total_spaces = 0; ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs); - if (ret) { + if (ret < 0) { error("cannot get space info on '%s': %s", path, strerror(errno)); free(sargs); @@ -266,7 +266,7 @@ static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path) sargs->total_spaces = 0; ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs); - if (ret) { + if (ret < 0) { error("cannot get space info with %u slots: %s", count, strerror(errno)); free(sargs); |