diff options
author | Martin Storsjö <martin@martin.st> | 2012-06-19 15:28:48 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-06-19 20:24:33 +0300 |
commit | 860b40f1f2f5ed2cda0f4a8f44a631ffd2f94482 (patch) | |
tree | 15a6f7ce294ce6fc7e4c37324c68daabbc4c84c4 /libavformat/udp.c | |
parent | 6aa4e88106a554cef1d2294bb0a18b8f843032ef (diff) | |
download | ffmpeg-860b40f1f2f5ed2cda0f4a8f44a631ffd2f94482.tar.gz |
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>
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r-- | libavformat/udp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c index 6571ab5d42..04433bc0af 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -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; } |