diff --git a/src/network.c b/src/network.c index 7bae20b..224f924 100644 --- a/src/network.c +++ b/src/network.c @@ -32,10 +32,11 @@ * Write the buffer to the socket. If an EINTR occurs, pick up and try * again. Keep sending until the buffer has been sent. */ -ssize_t safe_write (int fd, const char *buffer, size_t count) +ssize_t safe_write (int fd, const void *buf, size_t count) { ssize_t len; size_t bytestosend; + const char *buffer = buf; assert (fd >= 0); assert (buffer != NULL); @@ -67,7 +68,7 @@ ssize_t safe_write (int fd, const char *buffer, size_t count) * Matched pair for safe_write(). If an EINTR occurs, pick up and try * again. */ -ssize_t safe_read (int fd, char *buffer, size_t count) +ssize_t safe_read (int fd, void *buffer, size_t count) { ssize_t len; diff --git a/src/network.h b/src/network.h index 15af481..37c0fba 100644 --- a/src/network.h +++ b/src/network.h @@ -21,8 +21,8 @@ #ifndef TINYPROXY_NETWORK_H #define TINYPROXY_NETWORK_H -extern ssize_t safe_write (int fd, const char *buffer, size_t count); -extern ssize_t safe_read (int fd, char *buffer, size_t count); +extern ssize_t safe_write (int fd, const void *buf, size_t count); +extern ssize_t safe_read (int fd, void *buf, size_t count); extern int write_message (int fd, const char *fmt, ...); extern ssize_t readline (int fd, char **whole_buffer);