diff options
author | faust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-05-12 22:07:11 +0000 |
---|---|---|
committer | faust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-05-12 22:07:11 +0000 |
commit | 30ef9de4fe0ba3b1fcd98d39c267b952bbfb31f0 (patch) | |
tree | b688007d8e83635fa577490ef756465a26df854d /libmpdemux | |
parent | 3d450d038916ebc7ab4673a246086b1bb5042a9e (diff) | |
download | mpv-30ef9de4fe0ba3b1fcd98d39c267b952bbfb31f0.tar.bz2 mpv-30ef9de4fe0ba3b1fcd98d39c267b952bbfb31f0.tar.xz |
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
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/stream.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c index 60e174bb9c..d1e3320afe 100644 --- a/libmpdemux/stream.c +++ b/libmpdemux/stream.c @@ -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) |