From 722d3c01b7d62f7fa7ceef8a0b3433952e0210c3 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Fri, 28 Jun 2024 13:47:33 -0400 Subject: [PATCH] kernel/fs: Increment pos in readv/writev so long as it's not -1. This amends 20ac27def64f92a5003e04e2d40d4f9647fc183c. 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. --- src/system/kernel/fs/fd.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/fs/fd.cpp b/src/system/kernel/fs/fd.cpp index 53788598d1..af0adb3abd 100644 --- a/src/system/kernel/fs/fd.cpp +++ b/src/system/kernel/fs/fd.cpp @@ -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; }