summaryrefslogtreecommitdiffstats
path: root/src/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-01-01 11:18:49 +0000
committerRoy Marples <roy@marples.name>2020-01-01 11:18:49 +0000
commit16c11c9dd1e561b9fb6eeb2d454c5707a442ab0c (patch)
tree8f445d3873c92532aa467f98d4db5aecc6744925 /src/dhcpcd.c
parent1be93cd89121a59b71aa4f64550a0af181cdd740 (diff)
downloaddhcpcd-16c11c9dd1e561b9fb6eeb2d454c5707a442ab0c.tar.xz
eloop: Allow for for timeouts greater than time_t and time wrapping
On some systems time_t is int32_t. However, on wire timeouts are generally uint32_t. As such, we need to avoid using timespec internally except to record when the timeout was created. Instead, record the timeout as unsigned int seconds and long nanoseconds. On long running systems using time_t as int32_t, monotonic time would wrap after approximately 68 years. It's highly unlikely dhcpcd would be running for so long, but just incase it does, the code should now cope.
Diffstat (limited to 'src/dhcpcd.c')
-rw-r--r--src/dhcpcd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 9ec35ec1..c65fd49e 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -1562,8 +1562,7 @@ main(int argc, char **argv)
struct interface *ifp;
uint16_t family = 0;
int opt, oi = 0, i;
- unsigned int logopts;
- time_t t;
+ unsigned int logopts, t;
ssize_t len;
#if defined(USE_SIGNALS) || !defined(THERE_IS_NO_FORK)
pid_t pid;