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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to