netstat memory leak fixed.
[platform/upstream/net-tools.git] / arp.c
diff --git a/arp.c b/arp.c
index 3dd7187..72e87d6 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -8,7 +8,7 @@
  *              NET-3 Networking Distribution for the LINUX operating
  *              system.
  *
- * Version:     $Id: arp.c,v 1.26 2009/07/08 00:24:03 ecki Exp $
+ * Version:     $Id: arp.c,v 1.27 2009/09/06 22:50:11 vapier Exp $
  *
  * Maintainer:  Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
  *
@@ -243,7 +243,7 @@ static int arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw)
     struct ifreq ifr;
     struct hwtype *xhw;
 
-    strcpy(ifr.ifr_name, ifname);
+    strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
     if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) {
        fprintf(stderr, _("arp: cant get HW-Address for `%s': %s.\n"), ifname, strerror(errno));
        return (-1);
@@ -434,7 +434,7 @@ static int arp_file(char *name)
 
 
 /* Print the contents of an ARP request block. */
-static void arp_disp_2(char *name, int type, int arp_flags, char *hwa, char *mask, char *dev)
+static void arp_disp_2(const char *name, int type, int arp_flags, const char *hwa, const char *mask, const char *dev)
 {
     static int title = 0;
     struct hwtype *xhw;
@@ -484,7 +484,7 @@ static void arp_disp_2(char *name, int type, int arp_flags, char *hwa, char *mas
 }
 
 /* Print the contents of an ARP request block. */
-static void arp_disp(char *name, char *ip, int type, int arp_flags, char *hwa, char *mask, char *dev)
+static void arp_disp(const char *name, const char *ip, int type, int arp_flags, const char *hwa, const char *mask, const char *dev)
 {
     struct hwtype *xhw;
 
@@ -538,7 +538,7 @@ static int arp_show(char *name)
     char dev[100];
     int type, flags;
     FILE *fp;
-    char *hostname;
+    const char *hostname;
     int num, entries = 0, showed = 0;
 
     host[0] = '\0';
@@ -630,6 +630,7 @@ static void usage(void)
     fprintf(stderr, _("  arp [-v]   [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub          <-''-\n\n"));
     
     fprintf(stderr, _("        -a                       display (all) hosts in alternative (BSD) style\n"));
+    fprintf(stderr, _("        -e                       display (all) hosts in default (Linux) style\n"));
     fprintf(stderr, _("        -s, --set                set a new ARP entry\n"));
     fprintf(stderr, _("        -d, --delete             delete a specified entry\n"));
     fprintf(stderr, _("        -v, --verbose            be verbose\n"));