]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
timeval defines seconds as long, so we should use long over time_t
authorRoy Marples <roy@marples.name>
Wed, 7 Nov 2007 20:59:52 +0000 (20:59 +0000)
committerRoy Marples <roy@marples.name>
Wed, 7 Nov 2007 20:59:52 +0000 (20:59 +0000)
arp.c
client.c
common.c
common.h

diff --git a/arp.c b/arp.c
index f66240263d31498d10e27083cf849bf627fa3709..3d446a713b440a69fbc8646134afbfc2a1a76541 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -5,6 +5,7 @@
  * Distributed under the terms of the GNU General Public License v2
  */
 
+#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/select.h>
index a5efd4ee3e2cd1b127d225c8bd11056aca172f55..707bb6cb2dd254fc15873b6b1229a5273a4fef75 100644 (file)
--- a/client.c
+++ b/client.c
@@ -9,9 +9,9 @@
 # define _BSD_SOURCE
 #endif
 
+#include <sys/time.h>
 #include <sys/types.h>
 #include <sys/select.h>
-#include <sys/time.h>
 #include <arpa/inet.h>
 #ifdef __linux__
 # include <netinet/ether.h>
@@ -164,7 +164,7 @@ static pid_t daemonise (int *pidfd)
 
 #ifdef ENABLE_INFO
 static bool get_old_lease (const options_t *options, interface_t *iface,
-                                                  dhcp_t *dhcp, time_t *timeout)
+                                                  dhcp_t *dhcp, long *timeout)
 {
        struct timeval tv;
        unsigned int offset = 0;
@@ -226,7 +226,7 @@ int dhcp_run (const options_t *options, int *pidfd)
        int state = STATE_INIT;
        struct timeval tv;
        int xid = 0;
-       time_t timeout = 0;
+       long timeout = 0;
        fd_set rset;
        int maxfd;
        int retval;
@@ -236,13 +236,13 @@ int dhcp_run (const options_t *options, int *pidfd)
        int last_type = DHCP_DISCOVER;
        bool daemonised = options->daemonised;
        bool persistent = options->persistent;
-       time_t start = 0;
-       time_t last_send = 0;
+       long start = 0;
+       long last_send = 0;
        int sig;
        unsigned char *buffer = NULL;
        int buffer_len = 0;
        int buffer_pos = 0;
-       time_t nakoff = 1;
+       long nakoff = 1;
 
        if (! options || (iface = (read_interface (options->interface,
                                                                                           options->metric))) == NULL)
@@ -707,7 +707,7 @@ int dhcp_run (const options_t *options, int *pidfd)
                                
                                /* If we constantly get NAKS then we should slowly back off */
                                if (nakoff > 0) {
-                                       logger (LOG_DEBUG, "sleeping for %d seconds", nakoff);
+                                       logger (LOG_DEBUG, "sleeping for %ld seconds", nakoff);
                                        tv.tv_sec = nakoff;
                                        tv.tv_usec = 0;
                                        nakoff *= 2;
index 4fa3e52d46e7c2aadd816c423a0f0d24957fdb71..8aedb8d601788311cd95d036bd2233bd8838ecf2 100644 (file)
--- a/common.c
+++ b/common.c
@@ -121,7 +121,7 @@ int get_time (struct timeval *tp)
 #endif
 }
 
-time_t uptime (void)
+long uptime (void)
 {
        struct timeval tp;
 
index 7f77e6db98ff05d90ee4ce070256171c377cb2b6..c622b5d6ce6d8f8ccef37d0b3d26508a9ac05661 100644 (file)
--- a/common.h
+++ b/common.h
@@ -9,7 +9,6 @@
 #define COMMON_H
 
 /* string.h pulls in features.h so the below define checks work */
-#include <sys/time.h>
 #include <string.h>
 
 /* Only GLIBC doesn't support strlcpy */
@@ -25,7 +24,7 @@ void srandomdev (void);
 
 void close_fds (void);
 int get_time (struct timeval *tp);
-time_t uptime (void);
+long uptime (void);
 void writepid (int fd, pid_t pid);
 void *xmalloc (size_t size);
 char *xstrdup (const char *str);