summaryrefslogtreecommitdiff
path: root/cmds-inspect.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-01-12 13:35:50 +0100
committerDavid Sterba <dsterba@suse.com>2016-01-12 15:02:55 +0100
commitac4ec4d4f44e67fc3d1fd806cf7acbe2485cedee (patch)
tree434f39155069a914bc76d3e9fdca87a331012b7a /cmds-inspect.c
parent633dc6f80f201afdf5b8524ae377187d58f0ef3b (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-inspect.c')
-rw-r--r--cmds-inspect.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-inspect.c b/cmds-inspect.c
index 932765b..7fa4881 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -50,7 +50,7 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
ipa.fspath = ptr_to_u64(fspath);
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
- if (ret) {
+ if (ret < 0) {
printf("ioctl ret=%d, error: %s\n", ret, strerror(errno));
goto out;
}
@@ -189,7 +189,7 @@ static int cmd_inspect_logical_resolve(int argc, char **argv)
}
ret = ioctl(fd, BTRFS_IOC_LOGICAL_INO, &loi);
- if (ret) {
+ if (ret < 0) {
printf("ioctl ret=%d, error: %s\n", ret, strerror(errno));
goto out;
}