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-filesystem.c | |
parent | 633dc6f80f201afdf5b8524ae377187d58f0ef3b (diff) |
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-filesystem.c')
-rw-r--r-- | cmds-filesystem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 29ed7cb2..4c6e856b 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -141,7 +141,7 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret) sargs->total_spaces = 0; ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs); - if (ret) { + if (ret < 0) { error("cannot get space info: %s\n", strerror(errno)); free(sargs); return -errno; @@ -162,7 +162,7 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret) sargs->space_slots = count; sargs->total_spaces = 0; ret = ioctl(fd, BTRFS_IOC_SPACE_INFO, sargs); - if (ret) { + if (ret < 0) { error("cannot get space info with %llu slots: %s", count, strerror(errno)); free(sargs); |