Commit 04706d48 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

https: avoid EBADF on error

parent 4349f732
...@@ -97,10 +97,11 @@ static int vlc_tcp_connect(vlc_object_t *obj, const char *name, unsigned port) ...@@ -97,10 +97,11 @@ static int vlc_tcp_connect(vlc_object_t *obj, const char *name, unsigned port)
vlc_cleanup_pop(); vlc_cleanup_pop();
freeaddrinfo(res); freeaddrinfo(res);
if (fd != -1)
#ifndef _WIN32 #ifndef _WIN32
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
#else #else
ioctlsocket(fd, FIONBIO, &(unsigned long){ 1 }); ioctlsocket(fd, FIONBIO, &(unsigned long){ 1 });
#endif #endif
return fd; return fd;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment