From 156e593dccd90abb2a743c43d1384bb0912d5bda Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 20 Feb 2009 15:44:05 +0000 Subject: tested with gcc pedantic -> cleanup --- src/bsd/tun.c | 2 +- src/datatypes.h | 9 +++++---- src/linux/tun.c | 3 ++- src/options.c | 1 + src/sysexec.h | 2 +- src/udp.c | 8 ++++++-- 6 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/bsd/tun.c b/src/bsd/tun.c index bc10d5b..d52cf67 100644 --- a/src/bsd/tun.c +++ b/src/bsd/tun.c @@ -58,7 +58,7 @@ int tun_init(tun_device_t* dev, const char* dev_name, const char* dev_type, const char* ifcfg_addr, u_int16_t ifcfg_prefix) { if(!dev) - return; + return -1; tun_conf(dev, dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400); dev->actual_name_ = NULL; diff --git a/src/datatypes.h b/src/datatypes.h index 5cddbda..a616dfe 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -36,15 +36,16 @@ #define _DATATYPES_H_ #include +#include typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; typedef uint32_t u_int32_t; typedef uint64_t u_int64_t; -// typedef int8_t int8_t; -// typedef int16_t int16_t; -// typedef int32_t int32_t; -// typedef int64_t int64_t; +/* typedef int8_t int8_t; */ +/* typedef int16_t int16_t; */ +/* typedef int32_t int32_t; */ +/* typedef int64_t int64_t; */ typedef u_int32_t window_size_t; diff --git a/src/linux/tun.c b/src/linux/tun.c index 385da8d..1faf49d 100644 --- a/src/linux/tun.c +++ b/src/linux/tun.c @@ -41,6 +41,7 @@ #include "tun_helper.h" #include +#include #include #include #include @@ -56,7 +57,7 @@ int tun_init(tun_device_t* dev, const char* dev_name, const char* dev_type, const char* ifcfg_addr, u_int16_t ifcfg_prefix){ if(!dev) - return; + return -1; tun_conf(dev, dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400); dev->actual_name_ = NULL; diff --git a/src/options.c b/src/options.c index 0d6943a..6e02649 100644 --- a/src/options.c +++ b/src/options.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "log.h" diff --git a/src/sysexec.h b/src/sysexec.h index 5021392..07cac2c 100644 --- a/src/sysexec.h +++ b/src/sysexec.h @@ -38,7 +38,7 @@ int exec_script(const char* script, const char* ifname) { if(!script || !ifname) - return; + return -1; pid_t pid; pid = fork(); 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 +#include #include #include +#include +#include +#include #include 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); } -- cgit v1.2.3