[vlc-commits] https: avoid EBADF on error
    Rémi Denis-Courmont 
    git at videolan.org
       
    Thu Dec 31 15:09:48 CET 2015
    
    
  
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Dec 31 16:09:31 2015 +0200| [04706d48e6b8cdef3fa60f6111037fa2307bd6b1] | committer: Rémi Denis-Courmont
https: avoid EBADF on error
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=04706d48e6b8cdef3fa60f6111037fa2307bd6b1
---
 modules/access/http/transport.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/access/http/transport.c b/modules/access/http/transport.c
index 38f9309..8c3ec0d 100644
--- a/modules/access/http/transport.c
+++ b/modules/access/http/transport.c
@@ -97,10 +97,11 @@ static int vlc_tcp_connect(vlc_object_t *obj, const char *name, unsigned port)
     vlc_cleanup_pop();
     freeaddrinfo(res);
 
+    if (fd != -1)
 #ifndef _WIN32
-    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
+        fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
 #else
-    ioctlsocket(fd, FIONBIO, &(unsigned long){ 1 });
+        ioctlsocket(fd, FIONBIO, &(unsigned long){ 1 });
 #endif
     return fd;
 }
    
    
More information about the vlc-commits
mailing list