mirror of
https://github.com/matrix-construct/construct
synced 2024-06-02 18:18:56 +02:00
ircd::fs: Assertions for file read length sanity.
This commit is contained in:
parent
3c3fb030bc
commit
fc0b6bbecb
|
@ -3421,6 +3421,7 @@ const noexcept try
|
||||||
fs::read(fd, buf, opts)
|
fs::read(fd, buf, opts)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert(!opts.all || size(read) == length);
|
||||||
*result = slice(read);
|
*result = slice(read);
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
@ -3862,6 +3863,7 @@ const noexcept try
|
||||||
fs::read(fd, buf, opts)
|
fs::read(fd, buf, opts)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert(!opts.all || size(read) == length);
|
||||||
*result = slice(read);
|
*result = slice(read);
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1089,6 +1089,7 @@ ircd::fs::_read_asio(const fd &fd,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
assert(ret <= bytes(iov));
|
||||||
assert(ret || ec == eof);
|
assert(ret || ec == eof);
|
||||||
if(unlikely(ec && ec != eof))
|
if(unlikely(ec && ec != eof))
|
||||||
throw_system_error(ec);
|
throw_system_error(ec);
|
||||||
|
|
Loading…
Reference in a new issue