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 /btrfs-list.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 'btrfs-list.c')
-rw-r--r-- | btrfs-list.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/btrfs-list.c b/btrfs-list.c index f084b322..2da54bf7 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -643,7 +643,7 @@ static int lookup_ino_path(int fd, struct root_info *ri) args.objectid = ri->dir_id; ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args); - if (ret) { + if (ret < 0) { if (errno == ENOENT) { ri->ref_tree = 0; return -ENOENT; @@ -699,7 +699,7 @@ static u64 find_root_gen(int fd) /* this ioctl fills in ino_args->treeid */ ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &ino_args); - if (ret) { + if (ret < 0) { fprintf(stderr, "ERROR: Failed to lookup path for dirid %llu - %s\n", (unsigned long long)BTRFS_FIRST_FREE_OBJECTID, strerror(errno)); @@ -786,7 +786,7 @@ static char *__ino_resolve(int fd, u64 dirid) args.objectid = dirid; ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args); - if (ret) { + if (ret < 0) { fprintf(stderr, "ERROR: Failed to lookup path for dirid %llu - %s\n", (unsigned long long)dirid, strerror(errno)); return ERR_PTR(ret); |