aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-08-29 09:48:49 +0200
committerMax Kellermann <max@duempel.org>2011-08-29 09:52:51 +0200
commitd49a2ccb08ad71bde6716a916f9284e0e0548f63 (patch)
tree681a1998148d8ced5182b2649678e2833a94492b
parent4a75acb46c31c6bef7522133e7fcd4b11640e509 (diff)
downloadmpd-d49a2ccb08ad71bde6716a916f9284e0e0548f63.tar.gz
mpd-d49a2ccb08ad71bde6716a916f9284e0e0548f63.tar.xz
mpd-d49a2ccb08ad71bde6716a916f9284e0e0548f63.zip
ntp_server: fix socket types
Cast recvfrom(), sendto() buffers to "void*" to avoid "char*" / "unsigned char*" confusion. Use ssize_t for the return value, and socklen_t for the socket address size.
-rw-r--r--src/ntp_server.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ntp_server.c b/src/ntp_server.c
index 3d8298f4a..0705c7fc9 100644
--- a/src/ntp_server.c
+++ b/src/ntp_server.c
@@ -81,8 +81,9 @@ ntp_server_handle(struct ntp_server *ntp)
unsigned char buf[32];
struct sockaddr addr;
int iter;
- unsigned int addr_len = sizeof(addr);
- int num_bytes = recvfrom(ntp->fd, buf, sizeof(buf), 0, &addr, &addr_len);
+ socklen_t addr_len = sizeof(addr);
+ ssize_t num_bytes = recvfrom(ntp->fd, (void *)buf, sizeof(buf), 0,
+ &addr, &addr_len);
if (num_bytes == 0) {
return false;
}
@@ -95,7 +96,8 @@ ntp_server_handle(struct ntp_server *ntp)
}
fill_time_buffer(buf + 24);
- num_bytes = sendto(ntp->fd, buf, num_bytes, 0, &addr, addr_len);
+ num_bytes = sendto(ntp->fd, (void *)buf, num_bytes, 0,
+ &addr, addr_len);
return num_bytes == sizeof(buf);
}