Commit 860b40f1 authored by Martin Storsjö's avatar Martin Storsjö

udp: Properly print error from getnameinfo

getnameinfo doesn't set errno on failure, it returns an error code,
which should be handled by gai_strerror instead of the normal
strerror.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 6aa4e881
......@@ -218,9 +218,10 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,
static int udp_port(struct sockaddr_storage *addr, int addr_len)
{
char sbuf[sizeof(int)*3+1];
int error;
if (getnameinfo((struct sockaddr *)addr, addr_len, NULL, 0, sbuf, sizeof(sbuf), NI_NUMERICSERV) != 0) {
av_log(NULL, AV_LOG_ERROR, "getnameinfo: %s\n", strerror(errno));
if ((error = getnameinfo((struct sockaddr *)addr, addr_len, NULL, 0, sbuf, sizeof(sbuf), NI_NUMERICSERV)) != 0) {
av_log(NULL, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(error));
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment