Blob Blame Raw
From 4d5514f9579197a4200a52332a9047da1424b3ee Mon Sep 17 00:00:00 2001
From: Jiri Popelka <jpopelka@redhat.com>
Date: Thu, 4 Sep 2014 16:03:38 +0200
Subject: [PATCH] [dhclient -6] fix lease time exporting

addr->preferred_life and addr->max_life are u_int32_t
so casting them to (int) causes problems with big values,
for example with 'infinity' (0xffffffff), which is
then represented as '-1' in dhclient-script.

Signed-off-by: Jiri Popelka <jpopelka@redhat.com>
---
 client/dhc6.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/client/dhc6.c b/client/dhc6.c
index c724b58..04a8fa0 100644
--- a/client/dhc6.c
+++ b/client/dhc6.c
@@ -3862,10 +3862,10 @@ dhc6_marshall_values(const char *prefix, struct client_state *client,
 		}
 		client_envadd(client, prefix, "life_starts", "%d",
 			      (int)(addr->starts));
-		client_envadd(client, prefix, "preferred_life", "%d",
-			      (int)(addr->preferred_life));
-		client_envadd(client, prefix, "max_life", "%d",
-			      (int)(addr->max_life));
+		client_envadd(client, prefix, "preferred_life", "%u",
+			      addr->preferred_life);
+		client_envadd(client, prefix, "max_life", "%u",
+			      addr->max_life);
 	}
 
 	/* ia fields. */
-- 
2.1.0