mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-18 21:30:55 +00:00
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: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
6aa4e88106
commit
860b40f1f2
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user