diff options
author | Christian Pointner <equinox@anytun.org> | 2009-02-20 15:44:05 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-02-20 15:44:05 +0000 |
commit | 156e593dccd90abb2a743c43d1384bb0912d5bda (patch) | |
tree | 1065f736873e2a323768e09cf8020c7fa26d23cb /src/udp.c | |
parent | fixed compat mode bug (diff) |
tested with gcc pedantic -> cleanup
Diffstat (limited to 'src/udp.c')
-rw-r--r-- | src/udp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); } |