diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-04-27 17:54:25 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-04-27 17:54:25 +0000 |
commit | 62113b7821ed39b3688315aee033a07ea1c43970 (patch) | |
tree | 2f99e33afc79fbca07041722e2df69674c77a42d /sbin/dhclient/dhclient.c | |
parent | 565994089555a60531c0a9fe27a5b650528984c9 (diff) |
Use same parse_date() and date writing logic as in dhcpd. i.e.
strptime() rather than handrolling parsing. Change date format
in leases to same as dhcpd, fixing 'u' vs 'w' error made in
initial strftime() introduction.
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r-- | sbin/dhclient/dhclient.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index c07e0d7cc64..cb044d9d9cc 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.243 2013/04/25 06:43:20 otto Exp $ */ +/* $OpenBSD: dhclient.c,v 1.244 2013/04/27 17:54:24 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1675,18 +1675,20 @@ lease_as_string(char *type, struct client_lease *lease) sz -= rslt; } -#define TIMEFMT "%u %Y/%m/%d %T;\n" - rsltsz = strftime(p, sz, " renew " TIMEFMT, gmtime(&lease->renewal)); + rsltsz = strftime(p, sz, " renew " DB_TIMEFMT ";\n", + gmtime(&lease->renewal)); if (rsltsz == 0) return (NULL); p += rsltsz; sz -= rsltsz; - rsltsz = strftime(p, sz, " rebind " TIMEFMT, gmtime(&lease->rebind)); + rsltsz = strftime(p, sz, " rebind " DB_TIMEFMT ";\n", + gmtime(&lease->rebind)); if (rsltsz == 0) return (NULL); p += rsltsz; sz -= rsltsz; - rsltsz = strftime(p, sz, " expire " TIMEFMT, gmtime(&lease->expiry)); + rsltsz = strftime(p, sz, " expire " DB_TIMEFMT ";\n", + gmtime(&lease->expiry)); if (rsltsz == 0) return (NULL); p += rsltsz; |