[MPlayer-cvslog] r37773 - trunk/udp_sync.c
reimar
subversion at mplayerhq.hu
Sat Feb 20 14:19:24 CET 2016
Author: reimar
Date: Sat Feb 20 14:19:24 2016
New Revision: 37773
Log:
udp_sync: handle bind() failure.
Modified:
trunk/udp_sync.c
Modified: trunk/udp_sync.c
==============================================================================
--- trunk/udp_sync.c Sat Feb 20 14:14:17 2016 (r37772)
+++ trunk/udp_sync.c Sat Feb 20 14:19:24 2016 (r37773)
@@ -25,6 +25,7 @@
#if !HAVE_WINSOCK2_H
#include <errno.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -112,7 +113,11 @@ static int get_udp(int blocking, double
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(udp_port);
- bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
+ if (bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) == -1) {
+ closesocket(sockfd);
+ sockfd = -1;
+ return -1;
+ }
setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
More information about the MPlayer-cvslog
mailing list