# HG changeset patch # User faust3 # Date 1115935631 0 # Node ID ae5e1b9e3c92a347136a0869a0e73162db924b3e # Parent f3cf481bbcda1626efb82d792e04333a47b4d2ab fix segfaults caused by socket and file descriptor mismatches on windows diff -r f3cf481bbcda -r ae5e1b9e3c92 libmpdemux/stream.c --- a/libmpdemux/stream.c Thu May 12 17:35:58 2005 +0000 +++ b/libmpdemux/stream.c Thu May 12 22:07:11 2005 +0000 @@ -444,7 +444,14 @@ 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)