summaryrefslogtreecommitdiffstats
path: root/src/socket.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-11-13 19:22:38 +0100
committerJan Engelhardt <jengelh@medozas.de>2010-11-16 12:23:52 +0100
commita90cfc66d9c8ed0e7a645e3d9a0b85754d1b0f18 (patch)
tree5e09eb7544ee7f8feb38e849cc2cd6f9dba58cd1 /src/socket.c
parent478dc5f4ab8d0a639d1bafe3bd53ff3309727836 (diff)
socket: propagate sendto/recvmsg's return types
sendto/recvfrom return ssize_t, so libmnl should not truncate the result range. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c
index cc997df..9b102e7 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -169,7 +169,8 @@ int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups, pid_t pid)
* On error, it returns -1 and errno is appropriately set. Otherwise, it
* returns the number of bytes sent.
*/
-int mnl_socket_sendto(const struct mnl_socket *nl, const void *buf, size_t len)
+ssize_t mnl_socket_sendto(const struct mnl_socket *nl, const void *buf,
+ size_t len)
{
static const struct sockaddr_nl snl = {
.nl_family = AF_NETLINK
@@ -192,9 +193,10 @@ int mnl_socket_sendto(const struct mnl_socket *nl, const void *buf, size_t len)
* buffer size ensures that your buffer is big enough to store the netlink
* message without truncating it.
*/
-int mnl_socket_recvfrom(const struct mnl_socket *nl, void *buf, size_t bufsiz)
+ssize_t mnl_socket_recvfrom(const struct mnl_socket *nl, void *buf,
+ size_t bufsiz)
{
- int ret;
+ ssize_t ret;
struct sockaddr_nl addr;
struct iovec iov = {
.iov_base = buf,