1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-11 09:25:56 +00:00

fix segfaults caused by socket and file descriptor mismatches on windows

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15422 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
faust3 2005-05-12 22:07:11 +00:00
parent 3d450d0389
commit 30ef9de4fe

View File

@ -444,7 +444,14 @@ void free_stream(stream_t *s){
default:
if(s->close) s->close(s);
}
if(s->fd>0) closesocket(s->fd);
if(s->fd>0){
/* on unix we define closesocket to close
on windows however we have to distinguish between
network socket and file */
if(s->url && strstr(s->url,"://"))
closesocket(s->fd);
else close(s->fd);
}
#ifdef HAVE_WINSOCK2
mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n");
WSACleanup(); // there might be a better place for this (-> later)