From: Roy Marples Date: Mon, 10 Nov 2008 11:15:27 +0000 (+0000) Subject: Fix some LINT errors. X-Git-Tag: v5.0.0~188 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ad4d331afc3c7959cf9ca0c694adb190337a634;p=thirdparty%2Fdhcpcd.git Fix some LINT errors. --- diff --git a/common.c b/common.c index 802b42be..d68179ff 100644 --- a/common.c +++ b/common.c @@ -25,6 +25,8 @@ * SUCH DAMAGE. */ +#include + #ifdef __APPLE__ # include # include @@ -69,7 +71,7 @@ free_lbuf(void) * us smaller. * As we don't use threads, this API is clean too. */ char * -get_line(FILE * restrict fp) +get_line(FILE * __restrict fp) { char *p, *e; size_t last; diff --git a/common.h b/common.h index c5879452..1f78b35f 100644 --- a/common.h +++ b/common.h @@ -56,6 +56,11 @@ # define _unused #endif +/* We require a c99 compiler, but we need this define to satisfy lint */ +#ifndef __restrict +# define __restrict restrict +#endif + #ifndef HAVE_ARC4RANDOM # ifdef __GLIBC__ uint32_t arc4random(void); @@ -86,7 +91,7 @@ int closefrom(int); int set_cloexec(int); int set_nonblock(int); -char *get_line(FILE * restrict); +char *get_line(FILE * __restrict); extern int clock_monotonic; int get_monotonic(struct timeval *); time_t uptime(void); diff --git a/config.h b/config.h index d49736d3..b9d7c7f6 100644 --- a/config.h +++ b/config.h @@ -28,7 +28,7 @@ #define CONFIG_H #define PACKAGE "dhcpcd" -#define VERSION "4.99.3" +#define VERSION "4.99.4" /* Some systems do not have a working fork. */ /* #define THERE_IS_NO_FORK */ diff --git a/control.c b/control.c index 79c79bc8..9ea2a55d 100644 --- a/control.c +++ b/control.c @@ -88,6 +88,7 @@ handle_control_data(void *arg) } } +/* ARGSUSED */ static void handle_control(_unused void *arg) { diff --git a/dhcpcd.c b/dhcpcd.c index e2d2b4cd..3cc27f0a 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -84,7 +84,7 @@ struct dhcp_op { const char *name; }; -static const struct dhcp_op const dhcp_ops[] = { +static const struct dhcp_op dhcp_ops[] = { { DHCP_DISCOVER, "DHCP_DISCOVER" }, { DHCP_OFFER, "DHCP_OFFER" }, { DHCP_REQUEST, "DHCP_REQUEST" }, @@ -171,6 +171,7 @@ cleanup(void) #endif } +/* ARGSUSED */ _noreturn void handle_exit_timeout(_unused void *arg) { @@ -964,6 +965,7 @@ handle_remove_interface(const char *ifname) stop_interface(iface, "STOP"); } +/* ARGSUSED */ static void handle_link(_unused void *arg) { @@ -974,6 +976,7 @@ handle_link(_unused void *arg) syslog(LOG_ERR, "manage_link: %m"); } +/* ARGSUSED */ static void handle_signal(_unused void *arg) { diff --git a/dhcpcd.h b/dhcpcd.h index ea4a37df..f625707e 100644 --- a/dhcpcd.h +++ b/dhcpcd.h @@ -34,6 +34,7 @@ #include #include "dhcp.h" +#include "if-options.h" #define HWADDR_LEN 20 diff --git a/eloop.h b/eloop.h index f29425bf..bad008a3 100644 --- a/eloop.h +++ b/eloop.h @@ -30,8 +30,6 @@ #include -#include "dhcpcd.h" - void add_event(int fd, void (*)(void *), void *); void delete_event(int fd); void add_timeout_sec(time_t, void (*)(void *), void *); diff --git a/if-bsd.c b/if-bsd.c index 890664d0..cc1b54f3 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -134,6 +134,7 @@ if_address(const struct interface *iface, const struct in_addr *address, return retval; } +/* ARGSUSED4 */ int if_route(const struct interface *iface, const struct in_addr *dest, const struct in_addr *net, const struct in_addr *gate, diff --git a/net.c b/net.c index bf82588e..01f99a74 100644 --- a/net.c +++ b/net.c @@ -632,36 +632,29 @@ int valid_udp_packet(const uint8_t *data) { struct udp_dhcp_packet packet; - uint16_t bytes; - uint16_t ipsum; - uint16_t iplen; - uint16_t udpsum; - struct in_addr source; - struct in_addr dest; + uint16_t bytes, udpsum; + struct in_addr dest, source; int retval = 0; memcpy(&packet, data, sizeof(packet)); - bytes = ntohs(packet.ip.ip_len); - ipsum = packet.ip.ip_sum; - iplen = packet.ip.ip_len; - udpsum = packet.udp.uh_sum; - - if (0 != checksum(&packet.ip, sizeof(packet.ip))) { + if (checksum(&packet.ip, sizeof(packet.ip)) != 0) { errno = EINVAL; return -1; } + bytes = ntohs(packet.ip.ip_len); packet.ip.ip_sum = 0; memcpy(&source, &packet.ip.ip_src, sizeof(packet.ip.ip_src)); memcpy(&dest, &packet.ip.ip_dst, sizeof(packet.ip.ip_dst)); memset(&packet.ip, 0, sizeof(packet.ip)); + udpsum = packet.udp.uh_sum; packet.udp.uh_sum = 0; packet.ip.ip_p = IPPROTO_UDP; memcpy(&packet.ip.ip_src, &source, sizeof(packet.ip.ip_src)); memcpy(&packet.ip.ip_dst, &dest, sizeof(packet.ip.ip_dst)); packet.ip.ip_len = packet.udp.uh_ulen; - if (udpsum && udpsum != checksum(&packet, bytes)) { + if (udpsum && checksum(&packet, bytes) != udpsum) { errno = EINVAL; retval = -1; }