summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/sd-dhcp-client.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-12 16:59:52 +0100
committerTom Gundersen <teg@jklm.no>2014-02-12 17:07:31 +0100
commitc6f7b693fedfd822febc219868fc810c32d458c5 (patch)
tree7b335d9d9d18d5279595da20cea4541b71829b2d /src/libsystemd-dhcp/sd-dhcp-client.c
parent60ad0c85e58ea8f546677c1d2e425551f7b96179 (diff)
sd-dhcp: make sure client->secs > 0
Some DHCP servers will not work correctly if secs == 0, so round up to at least 1.
Diffstat (limited to 'src/libsystemd-dhcp/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-dhcp/sd-dhcp-client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd-dhcp/sd-dhcp-client.c b/src/libsystemd-dhcp/sd-dhcp-client.c
index 4f41b4c06a..3b4db1d96f 100644
--- a/src/libsystemd-dhcp/sd-dhcp-client.c
+++ b/src/libsystemd-dhcp/sd-dhcp-client.c
@@ -338,7 +338,7 @@ static int client_send_request(sd_dhcp_client *client, uint16_t secs) {
static uint16_t client_update_secs(sd_dhcp_client *client, usec_t time_now)
{
- client->secs = (time_now - client->start_time) / USEC_PER_SEC;
+ client->secs = ((time_now - client->start_time) / USEC_PER_SEC) ? : 1;
return client->secs;
}