mgcp_client: do not print (null) when address is ANY

When the address is set to ANY, the address string is NULL. The log then
prints "(null)" where the address normaly would be. This looks odd, lets
print "(any)" instead.

Change-Id: I2ea138827ee5b9f40d352bf594364ee930520609
This commit is contained in:
Philipp Maier 2021-07-29 11:55:14 +02:00
parent c534ad17dc
commit 276a414aa3
1 changed files with 5 additions and 3 deletions

View File

@ -824,7 +824,8 @@ static int init_socket(struct mgcp_client *mgcp)
/* Choose a new port number to try next */
LOGP(DLMGCP, LOGL_NOTICE,
"MGCPGW failed to bind to %s:%u, retrying with port %u\n",
mgcp->actual.local_addr, mgcp->actual.local_port, mgcp->actual.local_port + 1);
mgcp->actual.local_addr ? mgcp->actual.local_addr : "(any)", mgcp->actual.local_port,
mgcp->actual.local_port + 1);
mgcp->actual.local_port++;
}
@ -892,8 +893,9 @@ int mgcp_client_connect(struct mgcp_client *mgcp)
if (rc < 0) {
LOGP(DLMGCP, LOGL_FATAL,
"Failed to initialize socket %s:%u -> %s:%u for MGCP GW: %s\n",
mgcp->actual.local_addr, mgcp->actual.local_port,
mgcp->actual.remote_addr, mgcp->actual.remote_port, strerror(errno));
mgcp->actual.local_addr ? mgcp->actual.local_addr : "(any)", mgcp->actual.local_port,
mgcp->actual.remote_addr ? mgcp->actual.local_addr : "(any)", mgcp->actual.remote_port,
strerror(errno));
goto error_close_fd;
}