The targets are not always hostnames

If a target specified on the command line equals its IP address string,
don't put the string as a hostname in the results.
This commit is contained in:
Přemysl Eric Janouch 2014-09-26 20:49:55 +02:00
parent fcf21ca4cf
commit 31bb98c995
1 changed files with 4 additions and 2 deletions

View File

@ -1505,8 +1505,6 @@ generator_make_target (struct app_context *ctx)
target->ref_count = 1;
target->ctx = ctx;
target->ip = g->ip_iter;
if (g->ip_iter == g->ip_range_iter->original_address)
target->hostname = xstrdup (g->ip_range_iter->original_name);
uint32_t address = htonl (target->ip);
if (!inet_ntop (AF_INET, &address,
@ -1516,6 +1514,10 @@ generator_make_target (struct app_context *ctx)
*target->ip_string = '\0';
}
if (g->ip_iter == g->ip_range_iter->original_address
&& strcmp (target->ip_string, g->ip_range_iter->original_name))
target->hostname = xstrdup (g->ip_range_iter->original_name);
LIST_APPEND_WITH_TAIL (ctx->running_targets, ctx->running_tail, target);
target_update_indicator (ctx->running_targets);