From: Andre Noll Date: Mon, 2 Jun 2025 21:34:21 +0000 (+0200) Subject: fd: Modify xwrite() and write_all() to take void * buffer argument. X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=88f32f1aee78700647bd1f834e592cdb5e8adbf7;p=paraslash.git fd: Modify xwrite() and write_all() to take void * buffer argument. That's what the underlying call to writev(2) expects. --- diff --git a/fd.c b/fd.c index 1a71f45a..6f9051bc 100644 --- a/fd.c +++ b/fd.c @@ -119,7 +119,7 @@ int xwritev(int fd, struct iovec *iov, int iovcnt) * * \return The return value of the underlying call to \ref xwritev(). */ -int xwrite(int fd, const char *buf, size_t len) +int xwrite(int fd, const void *buf, size_t len) { struct iovec iov = {.iov_base = (void *)buf, .iov_len = len}; return xwritev(fd, &iov, 1); @@ -138,7 +138,7 @@ int xwrite(int fd, const char *buf, size_t len) * * \return Number of bytes written on success, negative error code else. */ -int write_all(int fd, const char *buf, size_t len) +int write_all(int fd, const void *buf, size_t len) { int ret = xwrite(fd, buf, len); diff --git a/fd.h b/fd.h index e4f30903..baf80d33 100644 --- a/fd.h +++ b/fd.h @@ -3,7 +3,7 @@ /** \file fd.h exported symbols from fd.c */ int xrename(const char *oldpath, const char *newpath); -int write_all(int fd, const char *buf, size_t len); +int write_all(int fd, const void *buf, size_t len); __printf_2_3 int write_va_buffer(int fd, const char *fmt, ...); int xpoll(struct pollfd *fds, nfds_t nfds, int timeout); __must_check int mark_fd_nonblocking(int fd); @@ -20,7 +20,7 @@ void valid_fd_012(void); int readv_nonblock(int fd, struct iovec *iov, int iovcnt, size_t *num_bytes); int read_nonblock(int fd, void *buf, size_t sz, size_t *num_bytes); int read_and_compare(int fd, const char *expectation); -int xwrite(int fd, const char *buf, size_t len); +int xwrite(int fd, const void *buf, size_t len); int xwritev(int fd, struct iovec *iov, int iovcnt); /**