Use returned network name from getnetbyaddr() correctly.

This commit is contained in:
Hajimu UMEMOTO 2015-11-05 11:02:28 +00:00
parent 6f53a03868
commit f3ffc9fdf9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290389

View File

@ -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);
}