[FFmpeg-cvslog] udp: Properly print error from getnameinfo

Martin Storsjö git at videolan.org
Wed Jun 20 21:25:29 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Jun 19 15:28:48 2012 +0300| [860b40f1f2f5ed2cda0f4a8f44a631ffd2f94482] | committer: 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: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=860b40f1f2f5ed2cda0f4a8f44a631ffd2f94482
---

 libavformat/udp.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 6571ab5..04433bc 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;
     }
 



More information about the ffmpeg-cvslog mailing list