0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-20 03:43:47 +02:00

ircd::fs: Assertions for file read length sanity.

This commit is contained in:
Jason Volk 2023-01-29 15:34:33 -08:00
parent 3c3fb030bc
commit fc0b6bbecb
2 changed files with 3 additions and 0 deletions

View file

@ -3421,6 +3421,7 @@ const noexcept try
fs::read(fd, buf, opts)
};
assert(!opts.all || size(read) == length);
*result = slice(read);
return Status::OK();
}
@ -3862,6 +3863,7 @@ const noexcept try
fs::read(fd, buf, opts)
};
assert(!opts.all || size(read) == length);
*result = slice(read);
return Status::OK();
}

View file

@ -1089,6 +1089,7 @@ ircd::fs::_read_asio(const fd &fd,
}
};
assert(ret <= bytes(iov));
assert(ret || ec == eof);
if(unlikely(ec && ec != eof))
throw_system_error(ec);