svn commit: r290389 - head/usr.bin/netstat

Hajimu UMEMOTO ume at FreeBSD.org
Thu Nov 5 11:02:30 UTC 2015


Author: ume
Date: Thu Nov  5 11:02:28 2015
New Revision: 290389
URL: https://svnweb.freebsd.org/changeset/base/290389

Log:
  Use returned network name from getnetbyaddr() correctly.

Modified:
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/route.c
==============================================================================
--- head/usr.bin/netstat/route.c	Thu Nov  5 10:58:19 2015	(r290388)
+++ head/usr.bin/netstat/route.c	Thu Nov  5 11:02:28 2015	(r290389)
@@ -637,14 +637,13 @@ netname4(in_addr_t in, in_addr_t mask)
 			trimdomain(cp, strlen(cp));
 		}
 	}
-	inet_ntop(AF_INET, &in, nline, sizeof(line));
-	if (cp != NULL) {
-		if (strcpy(cp, nline) != 0)
-			return (line);
+	if (cp != NULL)
 		strlcpy(line, cp, sizeof(line));
-	} else
+	else {
+		inet_ntop(AF_INET, &in, nline, sizeof(nline));
 		strlcpy(line, nline, sizeof(line));
-	domask(line + strlen(line), i, ntohl(mask));
+		domask(line + strlen(line), i, ntohl(mask));
+	}
 
 	return (line);
 }


More information about the svn-src-all mailing list