Revert the uptime() removal. Let the list sort it out...
authorRob Landley <rob@landley.net>
Wed, 4 May 2005 02:15:23 +0000 (02:15 -0000)
committerRob Landley <rob@landley.net>
Wed, 4 May 2005 02:15:23 +0000 (02:15 -0000)
networking/udhcp/arpping.c
networking/udhcp/common.c
networking/udhcp/common.h
networking/udhcp/dhcpc.c

index da01ddd715d728aaf98788b98751b8c14014c7a9..7cc2be42e8cf1b23cf12f041326d69a06679e137 100644 (file)
@@ -79,7 +79,7 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
 
        /* wait arp reply, and check it */
        tm.tv_usec = 0;
-       prevTime = time(NULL);
+       prevTime = uptime();
        while (timeout > 0) {
                FD_ZERO(&fdset);
                FD_SET(s, &fdset);
@@ -97,8 +97,8 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
                                break;
                        }
                }
-               timeout -= time(NULL) - prevTime;
-               prevTime = time(NULL);
+               timeout -= uptime() - prevTime;
+               prevTime = uptime();
        }
        close(s);
        DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");      
index 6ca7371d5f32c0015c8acc594fe884a9005e6934..bf2ac44174ec38008768958c9d4409c8f7c0a790 100644 (file)
 
 static int daemonized;
 
+long uptime(void)
+{
+       struct sysinfo info;
+       sysinfo(&info);
+       return info.uptime;
+}
+
+
 /*
  * This function makes sure our first socket calls
  * aren't going to fd 1 (printf badness...) and are
index cdc51cf8a925255f8d25df324f32e51a2773a149..ca19a24971de9f8ecd5c9d8ed7e1c60658dee068 100644 (file)
@@ -39,6 +39,7 @@ enum syslog_levels {
 #include <syslog.h>
 #endif
 
+long uptime(void);
 void background(const char *pidfile);
 void start_log_and_pid(const char *client_server, const char *pidfile);
 void background(const char *pidfile);
index 028338ff33e3f9a674478ef7d2fc20f684ea94ad..8009bec041a2785a9f4624b6ceece60578fc9cf0 100644 (file)
@@ -310,7 +310,7 @@ int main(int argc, char *argv[])
 
        for (;;) {
 
-               tv.tv_sec = timeout - time(NULL);
+               tv.tv_sec = timeout - uptime();
                tv.tv_usec = 0;
 
                if (listen_mode != LISTEN_NONE && fd < 0) {
@@ -330,7 +330,7 @@ int main(int argc, char *argv[])
                        retval = select(max_fd + 1, &rfds, NULL, NULL, &tv);
                } else retval = 0; /* If we already timed out, fall through */
 
-               now = time(NULL);
+               now = uptime();
                if (retval == 0) {
                        /* timeout dropped to zero */
                        switch (state) {