1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-06 13:36:36 +00:00

Use targetname, the forward DNS name, in Target::NameIP if it is

available, in preference to hostname, the reverse DNS name. NameIP is
used to represent the host in output messages.
This commit is contained in:
david
2009-10-26 18:17:08 +00:00
parent 7f62aa5196
commit d09218c755

View File

@@ -325,9 +325,12 @@ void Target::setTargetName(char *name) {
const char *Target::NameIP(char *buf, size_t buflen) {
assert(buf);
assert(buflen > 8);
if (hostname) {
if (targetname)
Snprintf(buf, buflen, "%s (%s)", targetname, targetipstring);
else if (hostname)
Snprintf(buf, buflen, "%s (%s)", hostname, targetipstring);
} else Strncpy(buf, targetipstring, buflen);
else
Strncpy(buf, targetipstring, buflen);
return buf;
}