changeset 10627:f7df841c8b74

ftp support for mingw
author faust3
date Sat, 16 Aug 2003 10:53:44 +0000
parents fd97f3727f15
children 35f76e323a83
files libmpdemux/stream_ftp.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/stream_ftp.c	Sat Aug 16 09:51:05 2003 +0000
+++ b/libmpdemux/stream_ftp.c	Sat Aug 16 10:53:44 2003 +0000
@@ -11,6 +11,11 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
+#ifndef HAVE_WINSOCK2
+#define closesocket close
+#else
+#include <winsock2.h>
+#endif
 
 #include "mp_msg.h"
 #include "stream.h"
@@ -256,7 +261,7 @@
   if(select(p->handle+1, &fds, NULL, NULL, &tv) > 0) {
     if(readresp(p,rsp_txt) != 2)
       mp_msg(MSGT_OPEN,MSGL_WARN, "[ftp] Warning the server didn't finished the transfert correctly: %s\n",rsp_txt);
-    close(s->fd);
+    closesocket(s->fd);
     s->fd = -1;
   }
 
@@ -266,7 +271,7 @@
     //int fl;
     
     // First close the fd
-    close(s->fd);
+    closesocket(s->fd);
     s->fd = 0;
     
     // Send send the telnet sequence needed to make the server react
@@ -334,13 +339,13 @@
   if(!p) return;
 
   if(s->fd > 0) {
-    close(s->fd);
+    closesocket(s->fd);
     s->fd = 0;
   }
 
   FtpSendCmd("QUIT\r\n",p,NULL);
 
-  if(p->handle) close(p->handle);
+  if(p->handle) closesocket(p->handle);
   if(p->buf) free(p->buf);
 
   m_struct_free(&stream_opts,p);