]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
fd: Modify xwrite() and write_all() to take void * buffer argument.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 2 Jun 2025 21:34:21 +0000 (23:34 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 4 Jun 2025 18:32:08 +0000 (20:32 +0200)
That's what the underlying call to writev(2) expects.

fd.c
fd.h

diff --git a/fd.c b/fd.c
index 1a71f45a3e0205fb754362551a040adf3971cf9a..6f9051bc34c646080edd780c5f8889b35285c6f0 100644 (file)
--- 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 e4f3090301b94c90c96452a94fb4b5fa11b7d801..baf80d33053ae02badfc117d709fc2dadeb68707 100644 (file)
--- 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);
 
 /**