read_remainder() takes a struct iovec * to describe where it will read its data, unlike write_remainder() which takes a const struct iovec *. At first this seems like it makes sense, since read_remainder() will alter data within the iovec. However, what it actually alters is data within the buffers described by the iovec, not the iovec entries itself. So, like write it should take a const struct iovec *. [This is a candidate for folding into the earlier patch] Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- util.c | 2 +- util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index 0e0f8a4b..a9ea90a0 100644 --- a/util.c +++ b/util.c @@ -717,7 +717,7 @@ int read_all_buf(int fd, void *buf, size_t len) * * Note: mode-specific seccomp profiles need to enable readv() to use this. */ -int read_remainder(int fd, struct iovec *iov, size_t cnt, size_t skip) +int read_remainder(int fd, const struct iovec *iov, size_t cnt, size_t skip) { size_t i = 0, offset; diff --git a/util.h b/util.h index 6924d08d..dfac63b1 100644 --- a/util.h +++ b/util.h @@ -205,7 +205,7 @@ int write_file(const char *path, const char *buf); int write_all_buf(int fd, const void *buf, size_t len); int write_remainder(int fd, const struct iovec *iov, size_t iovcnt, size_t skip); int read_all_buf(int fd, void *buf, size_t len); -int read_remainder(int fd, struct iovec *iov, size_t cnt, size_t skip); +int read_remainder(int fd, const struct iovec *iov, size_t cnt, size_t skip); void close_open_files(int argc, char **argv); bool snprintf_check(char *str, size_t size, const char *format, ...); -- 2.48.1