1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

Kernel: Make writev() work again

Vector::ensure_capacity() makes sure the underlying vector buffer can
contain all the data, but it doesn't update the Vector::size().

As a result, writev() would simply collect all the buffers to write,
and then do nothing.
This commit is contained in:
Andreas Kling 2020-01-26 10:10:15 +01:00
parent b93f6b07c2
commit b011857e4f
2 changed files with 35 additions and 1 deletions

View file

@ -1539,7 +1539,7 @@ ssize_t Process::sys$writev(int fd, const struct iovec* iov, int iov_count)
u64 total_length = 0;
Vector<iovec, 32> vecs;
vecs.ensure_capacity(iov_count);
vecs.resize(iov_count);
copy_from_user(vecs.data(), iov, iov_count * sizeof(iovec));
for (auto& vec : vecs) {
if (!validate_read(vec.iov_base, vec.iov_len))