]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix some LINT errors.
authorRoy Marples <roy@marples.name>
Mon, 10 Nov 2008 11:15:27 +0000 (11:15 +0000)
committerRoy Marples <roy@marples.name>
Mon, 10 Nov 2008 11:15:27 +0000 (11:15 +0000)
common.c
common.h
config.h
control.c
dhcpcd.c
dhcpcd.h
eloop.h
if-bsd.c
net.c

index 802b42be6faad55ab25cc192410eeb7b8f0474db..d68179fff2bbe05b4f8f69847272ecd04e9e1d7c 100644 (file)
--- a/common.c
+++ b/common.c
@@ -25,6 +25,8 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+
 #ifdef __APPLE__
 #  include <mach/mach_time.h>
 #  include <mach/kern_return.h>
@@ -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;
index c58794528dbf86ff37fe0783b0d81418d8cebe1b..1f78b35f8983b88b4d999dec517a675d40b0f55b 100644 (file)
--- a/common.h
+++ b/common.h
 # 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);
index d49736d3f779b5152bbbdc3c5d59eddefc3b036e..b9d7c7f6a7a332fecda095dce4f0d80fbf906f60 100644 (file)
--- 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 */
index 79c79bc80589a4e449bb684c7613ce16774739d5..9ea2a55d8162db63ac94caceabad9010afa73818 100644 (file)
--- a/control.c
+++ b/control.c
@@ -88,6 +88,7 @@ handle_control_data(void *arg)
        }
 }
 
+/* ARGSUSED */
 static void
 handle_control(_unused void *arg)
 {
index e2d2b4cdda395d7fec63a5527694602106b3363c..3cc27f0ae547b53f4fd01b3833ebaa9365353e7d 100644 (file)
--- 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)
 {
index ea4a37dfab519f42784fb734063d46c5c6f225c1..f625707e369c9f1a2d14feab05c7d316f52ad3de 100644 (file)
--- a/dhcpcd.h
+++ b/dhcpcd.h
@@ -34,6 +34,7 @@
 #include <limits.h>
 
 #include "dhcp.h"
+#include "if-options.h"
 
 #define HWADDR_LEN 20
 
diff --git a/eloop.h b/eloop.h
index f29425bf7190c25b75482fb8490a2b2dc108272f..bad008a397b5c717f52677d7cdd359ba9b16c7c6 100644 (file)
--- a/eloop.h
+++ b/eloop.h
@@ -30,8 +30,6 @@
 
 #include <time.h>
 
-#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 *);
index 890664d0039ff4e6d1386b7e9f45ae770f57bde8..cc1b54f36404c4f8cf6d63b3089719836121aff4 100644 (file)
--- 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 bf82588eb31239d16c40c19ecc3236b81c863671..01f99a74265f59d3f8158790da46d651c54323da 100644 (file)
--- 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;
        }