host: Don't log port if it is zero
This commit is contained in:
parent
d8e12fdb13
commit
2283c8148a
|
@ -139,7 +139,7 @@ int host_printf_hook(printf_hook_data_t *data, printf_hook_spec_t *spec,
|
|||
snprintf(buffer, sizeof(buffer),
|
||||
"(address conversion failed)");
|
||||
}
|
||||
else if (spec->hash)
|
||||
else if (spec->hash && port)
|
||||
{
|
||||
len = strlen(buffer);
|
||||
snprintf(buffer + len, sizeof(buffer) - len,
|
||||
|
|
|
@ -657,18 +657,18 @@ END_TEST
|
|||
static struct {
|
||||
char *addr;
|
||||
uint16_t port;
|
||||
/* results for %H, %+H, %#H (falls back to [0]) */
|
||||
/* results for %H, %+H, %#H (falls back to the first entry) */
|
||||
char *result[3];
|
||||
} printf_data[] = {
|
||||
{NULL, 0, { "(null)" }},
|
||||
{NULL, 500, { "(null)" }},
|
||||
{"%any", 0, { "%any", "0.0.0.0", "0.0.0.0[0]" }},
|
||||
{"%any", 0, { "%any", "0.0.0.0", "0.0.0.0" }},
|
||||
{"%any", 500, { "%any", "0.0.0.0", "0.0.0.0[500]" }},
|
||||
{"%any6", 0, { "%any6", "::", "::[0]" }},
|
||||
{"%any6", 0, { "%any6", "::", "::" }},
|
||||
{"%any6", 500, { "%any6", "::", "::[500]" }},
|
||||
{"192.168.0.1", 0, { "192.168.0.1", "192.168.0.1", "192.168.0.1[0]" }},
|
||||
{"192.168.0.1", 0, { "192.168.0.1" }},
|
||||
{"192.168.0.1", 500, { "192.168.0.1", "192.168.0.1", "192.168.0.1[500]" }},
|
||||
{"fec1::1", 0, { "fec1::1", "fec1::1", "fec1::1[0]" }},
|
||||
{"fec1::1", 0, { "fec1::1" }},
|
||||
{"fec1::1", 500, { "fec1::1", "fec1::1", "fec1::1[500]" }},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue