summaryrefslogtreecommitdiff
path: root/sockutils.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-07-30 14:17:19 -0700
committerGuy Harris <guy@alum.mit.edu>2016-07-30 14:17:19 -0700
commit77ab097b7322ff0c81d91acc7ab6dbe782e5b977 (patch)
treec54dd0ba9e20abc5d981d0a74f107df1d8b80a99 /sockutils.h
parent63ba5e620bfa172e864bc03cc1891964e98ad918 (diff)
downloadlibpcap-77ab097b7322ff0c81d91acc7ab6dbe782e5b977.tar.gz
Re-impose some of Winsock's limitations on sock_recv().
In Winsock, recv() takes an int as the size argument and returns an int as a return value, so it can't read more than INT_MAX bytes. Have it take a size_t as an argument (so you don't have to cast away warnings about narrowing sizeof values), return an error if it's bigger than INT_MAX (which it can be even on ILP32 platforms, as size_t is unsigned), and have the count of remaining bytes be an int.
Diffstat (limited to 'sockutils.h')
-rw-r--r--sockutils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sockutils.h b/sockutils.h
index cb41b96b..c3c2a619 100644
--- a/sockutils.h
+++ b/sockutils.h
@@ -211,7 +211,7 @@ void sock_geterror(const char *caller, char *errbuf, int errbufsize);
int sock_initaddress(const char *address, const char *port,
struct addrinfo *hints, struct addrinfo **addrinfo,
char *errbuf, int errbuflen);
-ssize_t sock_recv(SOCKET socket, void *buffer, size_t size, int receiveall,
+int sock_recv(SOCKET socket, void *buffer, size_t size, int receiveall,
char *errbuf, int errbuflen);
SOCKET sock_open(struct addrinfo *addrinfo, int server, int nconn, char *errbuf, int errbuflen);
int sock_close(SOCKET sock, char *errbuf, int errbuflen);