Permalink
Browse files

Fix safe_write prototype to equal write.

  • Loading branch information...
1 parent b8c1e42 commit 6bc613a54effac9ac260277d0b3dbc2aca6ba8fa @thommey thommey committed Feb 17, 2017
Showing with 5 additions and 4 deletions.
  1. +4 −3 src/net.c
  2. +1 −1 src/proto.h
View
@@ -793,15 +793,16 @@ int preparefdset(fd_set *fd, sock_list *slist, int slistmax, int tclonly, int tc
}
/* A safer version of write() that deals with partial writes. */
-void safe_write(int fd, const char *buf, size_t count)
+void safe_write(int fd, const void *buf, size_t count)
{
+ const char *bytes = buf;
ssize_t ret;
do {
- if ((ret = write(fd, buf, count)) == -1 && errno != EINTR) {
+ if ((ret = write(fd, bytes, count)) == -1 && errno != EINTR) {
putlog(LOG_MISC, "*", "Unexpected write() failure on attempt to write %zd bytes to fd %d: %s.", count, fd, strerror(errno));
break;
}
- } while ((buf += ret, count -= ret));
+ } while ((bytes += ret, count -= ret));
}
/* Attempts to read from all sockets in slist (upper array boundary slistmax-1)
View
@@ -292,7 +292,7 @@ int sock_has_data(int, int);
int sockoptions(int sock, int operation, int sock_options);
int flush_inbuf(int idx);
int findsock(int sock);
-void safe_write(int, const char *, size_t);
+void safe_write(int, const void *, size_t);
/* tcl.c */
struct threaddata *threaddata();

0 comments on commit 6bc613a

Please sign in to comment.