kernel/fs: Increment pos in readv/writev so long as it's not -1.

This amends 20ac27def6.

I missed an important case in that commit: if pos is not -1,
then movePosition will still be false, but we nonetheless
need to increment the read/write position.

Should fix #18921.
This commit is contained in:
Augustin Cavalier
2024-06-28 13:47:33 -04:00
parent 50fc99b8a5
commit 722d3c01b7
+3 -3
View File
@@ -819,7 +819,7 @@ common_user_vector_io(int fd, off_t pos, const iovec* userVecs, size_t count,
else
bytesTransferred += (ssize_t)length;
if (movePosition)
if (pos != -1)
pos += length;
if (length < vecs[i].iov_len)
@@ -1095,7 +1095,7 @@ _kern_readv(int fd, off_t pos, const iovec* vecs, size_t count)
else
bytesRead += (ssize_t)length;
if (movePosition)
if (pos != -1)
pos += vecs[i].iov_len;
}
@@ -1188,7 +1188,7 @@ _kern_writev(int fd, off_t pos, const iovec* vecs, size_t count)
else
bytesWritten += (ssize_t)length;
if (movePosition)
if (pos != -1)
pos += vecs[i].iov_len;
}