]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/udp.c
update flags
[ffmpeg] / libavformat / udp.c
index 9b1e1128a1037658250f9853f913a2e22ec699af..da3e253820d85f0f3a2dd17cafed4bab9d1b8260 100644 (file)
@@ -21,6 +21,7 @@
 #include "avformat.h"
 #include <unistd.h>
 #include "network.h"
+#include "os_support.h"
 
 #ifndef IPV6_ADD_MEMBERSHIP
 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
@@ -195,10 +196,9 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr, int *
 
 static int udp_port(struct sockaddr_storage *addr, int addr_len)
 {
-    char sbuf[NI_MAXSERV];
-    char hbuf[NI_MAXHOST];
+    char sbuf[sizeof(int)*3+1];
 
-    if (getnameinfo((struct sockaddr *)addr, addr_len, hbuf, sizeof(hbuf),  sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
+    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));
         return -1;
     }