mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 13:25:45 +02:00
fs: if search fails, return empty result set
Make sure the result set is empty before running the ioctl in case something tries to consume the result without checking the error status. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
a676928ed5
commit
0d5c018c3c
@ -823,6 +823,8 @@ namespace crucible {
|
||||
|
||||
ioctl_ptr->buf_size = m_buf_size;
|
||||
|
||||
m_result.clear();
|
||||
|
||||
// Don't bother supporting V1. Kernels that old have other problems.
|
||||
int rv = ioctl(fd, BTRFS_IOC_TREE_SEARCH_V2, ioctl_ptr);
|
||||
if (rv != 0) {
|
||||
@ -831,8 +833,6 @@ namespace crucible {
|
||||
|
||||
static_cast<btrfs_ioctl_search_key&>(*this) = ioctl_ptr->key;
|
||||
|
||||
m_result.clear();
|
||||
|
||||
size_t offset = pointer_distance(ioctl_ptr->buf, ioctl_ptr);
|
||||
for (decltype(nr_items) i = 0; i < nr_items; ++i) {
|
||||
BtrfsIoctlSearchHeader item;
|
||||
|
Loading…
x
Reference in New Issue
Block a user