summaryrefslogtreecommitdiff
path: root/networking/udhcp/dumpleases.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/dumpleases.c')
-rw-r--r--networking/udhcp/dumpleases.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index eab9713f4..6ebda94b6 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -2,7 +2,6 @@
2/* 2/*
3 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 3 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
4 */ 4 */
5
6#include "common.h" 5#include "common.h"
7#include "dhcpd.h" 6#include "dhcpd.h"
8#include "unicode.h" 7#include "unicode.h"
@@ -54,8 +53,7 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
54 /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */ 53 /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */
55 /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */ 54 /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */
56 55
57 if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at)) 56 xread(fd, &written_at, sizeof(written_at));
58 return 0;
59 written_at = ntoh64(written_at); 57 written_at = ntoh64(written_at);
60 curr = time(NULL); 58 curr = time(NULL);
61 if (curr < written_at) 59 if (curr < written_at)
@@ -68,15 +66,15 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
68 fmt = ":%02x"; 66 fmt = ":%02x";
69 } 67 }
70 addr.s_addr = lease.lease_nip; 68 addr.s_addr = lease.lease_nip;
71 /* actually, 15+1 and 19+1, +1 is a space between columns */
72 /* lease.hostname is char[20] and is always NUL terminated */
73#if ENABLE_FEATURE_ASSUME_UNICODE 69#if ENABLE_FEATURE_ASSUME_UNICODE
74 { 70 {
75 char *uni_name = unicode_conv_to_printable_fixedwidth(NULL, lease.hostname, 20); 71 char *uni_name = unicode_conv_to_printable_fixedwidth(NULL, lease.hostname, 19);
76 printf(" %-16s%s", inet_ntoa(addr), uni_name); 72 printf(" %-16s%s ", inet_ntoa(addr), uni_name);
77 free(uni_name); 73 free(uni_name);
78 } 74 }
79#else 75#else
76 /* actually, 15+1 and 19+1, +1 is a space between columns */
77 /* lease.hostname is char[20] and is always NUL terminated */
80 printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname); 78 printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname);
81#endif 79#endif
82 expires_abs = ntohl(lease.expires) + written_at; 80 expires_abs = ntohl(lease.expires) + written_at;