comparison libmpdemux/stream.c @ 15421:ae5e1b9e3c92

fix segfaults caused by socket and file descriptor mismatches on windows
author faust3
date Thu, 12 May 2005 22:07:11 +0000
parents 8b9738526dd7
children 5eb4994a691f
comparison
equal deleted inserted replaced
15420:f3cf481bbcda 15421:ae5e1b9e3c92
442 dvd_close(s->priv); 442 dvd_close(s->priv);
443 #endif 443 #endif
444 default: 444 default:
445 if(s->close) s->close(s); 445 if(s->close) s->close(s);
446 } 446 }
447 if(s->fd>0) closesocket(s->fd); 447 if(s->fd>0){
448 /* on unix we define closesocket to close
449 on windows however we have to distinguish between
450 network socket and file */
451 if(s->url && strstr(s->url,"://"))
452 closesocket(s->fd);
453 else close(s->fd);
454 }
448 #ifdef HAVE_WINSOCK2 455 #ifdef HAVE_WINSOCK2
449 mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n"); 456 mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n");
450 WSACleanup(); // there might be a better place for this (-> later) 457 WSACleanup(); // there might be a better place for this (-> later)
451 #endif 458 #endif
452 // Disabled atm, i don't like that. s->priv can be anything after all 459 // Disabled atm, i don't like that. s->priv can be anything after all