summaryrefslogtreecommitdiff
path: root/src/udp.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-20 15:44:05 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-20 15:44:05 +0000
commit156e593dccd90abb2a743c43d1384bb0912d5bda (patch)
tree1065f736873e2a323768e09cf8020c7fa26d23cb /src/udp.c
parentfixed compat mode bug (diff)
tested with gcc pedantic -> cleanup
Diffstat (limited to 'src/udp.c')
-rw-r--r--src/udp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/udp.c b/src/udp.c
index 35b4c86..933cbeb 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -39,14 +39,18 @@
#include "log.h"
#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
#include <netdb.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netinet/in.h>
int udp_init(udp_socket_t* sock, const char* local_addr, const char* port)
{
if(!sock || !port)
- return;
+ return -1;
sock->fd_ = 0;
memset(&(sock->local_end_), 0, sizeof(sock->local_end_));
@@ -185,7 +189,7 @@ int udp_read(udp_socket_t* sock, u_int8_t* buf, u_int32_t len, udp_endpoint_t* r
if(!sock || !remote_end)
return -1;
- int socklen = sizeof(*remote_end);
+ socklen_t socklen = sizeof(*remote_end);
return recvfrom(sock->fd_, buf, len, 0, (struct sockaddr *)remote_end, &socklen);
}