[Ffmpeg-cvslog] CVS: ffmpeg/libavformat udp.c,1.18,1.19
Michael Niedermayer CVS
michael
Thu Jul 21 23:10:25 CEST 2005
Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv26848
Modified Files:
udp.c
Log Message:
udp ipv6 localhost resolving patch by ("Hans Zandbelt": Hans Zandbelt, telin nl)
Index: udp.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/udp.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- udp.c 13 Jul 2005 10:18:35 -0000 1.18
+++ udp.c 21 Jul 2005 21:10:23 -0000 1.19
@@ -160,24 +160,26 @@
socklen_t addrlen;
char sbuf[NI_MAXSERV];
char hbuf[NI_MAXHOST];
- struct addrinfo *res0 = NULL;
- int family;
+ struct addrinfo *res0 = NULL, *res = NULL;
if (s->local_port != 0) {
res0 = udp_ipv6_resolve_host(0, s->local_port, SOCK_DGRAM, AF_UNSPEC, AI_PASSIVE);
if (res0 == 0)
goto fail;
- family = res0->ai_family;
+ for (res = res0; res; res=res->ai_next) {
+ udp_fd = socket(res->ai_family, SOCK_DGRAM, 0);
+ if (udp_fd > 0) break;
+ perror("socket");
+ }
} else {
- family = s->dest_addr.ss_family;
+ udp_fd = socket(s->dest_addr.ss_family, SOCK_DGRAM, 0);
+ if (udp_fd < 0)
+ perror("socket");
}
-
- udp_fd = socket(family, SOCK_DGRAM, 0);
- if (udp_fd < 0) {
- perror("socket");
+
+ if (udp_fd < 0)
goto fail;
- }
-
+
if (s->local_port != 0) {
if (bind(udp_fd, res0->ai_addr, res0->ai_addrlen) < 0) {
perror("bind");
More information about the ffmpeg-cvslog
mailing list