Signed-off-by: Zach Brown <zab@redhat.com>
if (getpath) {
name = btrfs_list_path_for_root(fd, root);
- if (IS_ERR(name))
- return PTR_ERR(name);
+ if (IS_ERR(name)) {
+ ret = PTR_ERR(name);
+ goto out;
+ }
if (!name) {
path_ptr[-1] = '\0';
path_fd = fd;
}
}
__ino_to_path_fd(inum, path_fd, verbose, full_path);
+ if (path_fd != fd)
+ close(path_fd);
} else {
printf("inode %llu offset %llu root %llu\n", inum,
offset, root);
}
out:
+ if (fd >= 0)
+ close(fd);
free(inodes);
return ret;
}