Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/arp arp(8): Fix the host output when arp -dav.



details:   https://anonhg.NetBSD.org/src/rev/d075aee74083
branches:  trunk
changeset: 363509:d075aee74083
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Tue Jul 31 09:45:52 2018 +0000

description:
arp(8): Fix the host output when arp -dav.

diffstat:

 usr.sbin/arp/arp.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r e114dc9f8a6d -r d075aee74083 usr.sbin/arp/arp.c
--- a/usr.sbin/arp/arp.c        Tue Jul 31 09:33:50 2018 +0000
+++ b/usr.sbin/arp/arp.c        Tue Jul 31 09:45:52 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arp.c,v 1.62 2018/07/11 03:10:48 ozaki-r Exp $ */
+/*     $NetBSD: arp.c,v 1.63 2018/07/31 09:45:52 nonaka Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)arp.c      8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.62 2018/07/11 03:10:48 ozaki-r Exp $");
+__RCSID("$NetBSD: arp.c,v 1.63 2018/07/31 09:45:52 nonaka Exp $");
 #endif
 #endif /* not lint */
 
@@ -497,6 +497,7 @@
 delete(const char *host, const char *info)
 {
        int mib[6];
+       char addr[sizeof("000.000.000.000\0")];
        size_t needed;
        char *lim, *buf, *next;
        struct rt_msghdr *rtm;
@@ -543,8 +544,10 @@
                found = true;
                ret = delete_one(rtm);
                if (vflag && ret == 0) {
-                       (void)printf("%s (%s) deleted\n", host,
+                       snprintf(addr, sizeof(addr), "%s",
                            inet_ntoa(sina->sin_addr));
+                       (void)printf("%s (%s) deleted\n",
+                           host != NULL ? host : addr, addr);
                }
        }
        if (host != NULL && !found)



Home | Main Index | Thread Index | Old Index