]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on NetBSD.
authorRoy Marples <roy@marples.name>
Sun, 10 Feb 2008 23:30:08 +0000 (23:30 +0000)
committerRoy Marples <roy@marples.name>
Sun, 10 Feb 2008 23:30:08 +0000 (23:30 +0000)
client.c
socket.c

index 8630186db5705206d384d8d3f6902b8b74808407..a05d63cf21c7fa480bbe58026484ccf5b8f1a6b6 100644 (file)
--- a/client.c
+++ b/client.c
@@ -523,12 +523,14 @@ static int wait_for_packet (struct pollfd *fds, state_t *state,
        while (state->timeout > 0 && retval == 0) {
                if (iface->fd == -1)
                        timeout = INFTIM;
-               else
+               else {
                        timeout = TIMEOUT_MINI;
-               if (state->timeout < timeout)
-                       timeout = (int) state->timeout;
+                       if (state->timeout < timeout)
+                               timeout = (int) state->timeout;
+                       timeout *= 1000;
+               }
                state->start = uptime ();
-               retval = poll (fds, iface->fd == -1 ? 1 : 2, timeout * 1000);
+               retval = poll (fds, iface->fd == -1 ? 1 : 2, timeout);
                state->timeout -= uptime () - state->start;
                if (retval == 0 && iface->fd != -1 && state->timeout > 0)
                        _send_message (state, state->last_type, options);
index 8292705feea8ba89cccd4eddaf01944b8aa09cf9..a3ceb8d092ad3ad9597b7b29a68504b0adc779ed 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -39,6 +39,7 @@
 #include <netinet/udp.h>
 #include <arpa/inet.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -375,7 +376,7 @@ ssize_t get_packet (const interface_t *iface, unsigned char *data,
                *buffer_len = read (iface->fd, bpf.buffer, iface->buffer_length);
                *buffer_pos = 0;
                if (*buffer_len < 1) {
-                       struct timespec tv;
+                       struct timespec ts;
                        logger (LOG_ERR, "read: %s", strerror (errno));
                        ts.tv_sec = 3;
                        ts.tv_nsec = 0;