[FFmpeg-devel] [PATCH] adding _GNU_SOURCE for udp.c compilation

Reimar Döffinger Reimar.Doeffinger
Sun Feb 10 23:38:18 CET 2008

On Sun, Feb 10, 2008 at 11:15:12PM +0100, Zdenek Kabelac wrote:
> 2008/2/10, Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> > On Sun, Feb 10, 2008 at 10:25:08PM +0200, ?smail D?nmez wrote:
> > > These definitons come from BSD itself so its not GNU spesific at all
> > > so they shouldn't be under GNU namespace.
> >
> > Even if it is BSD and not GNU that still is not POSIX and has no place
> > in FFmpeg, at least not as something that is required.
> Well I've just pointed the problem :) and proposed only the simplest solution :)
> So don't kill me ;)

I don't think anyone intends to do that.
But you solution is only suitable for a project that does not care a bit
about portability or ugly hacks.
I suggest attached patch. It is not beautiful, but should be good
IMO implementing dynamic size and EAI_OVERFLOW checking is overkill,
esp. if the man page is right that even BIND has these limits...

Reimar D?ffinger
-------------- next part --------------
diff --git a/libavformat/udp.c b/libavformat/udp.c
index d5a48be..1124fd9 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -194,6 +194,13 @@ static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr, int *
     return -1;
+#ifndef NI_MAXSERV
+#define NI_MAXSERV 32
+#ifndef NI_MAXHOST
+#define NI_MAXHOST 1025
 static int udp_port(struct sockaddr_storage *addr, int addr_len)
     char sbuf[NI_MAXSERV];

More information about the ffmpeg-devel mailing list