[vlc-commits] ftp: use vlc_recv_i11e() and add missing I/O error handling

Rémi Denis-Courmont git at videolan.org
Wed Jul 1 18:22:12 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jun 30 23:52:51 2015 +0300| [18a5cc0a66828988e49888abc0a352efcbbeb791] | committer: Rémi Denis-Courmont

ftp: use vlc_recv_i11e() and add missing I/O error handling

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=18a5cc0a66828988e49888abc0a352efcbbeb791
---

 modules/access/ftp.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index e5c5cfc..36f7bb9 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -30,20 +30,20 @@
 # include "config.h"
 #endif
 
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-
 #include <assert.h>
+#include <errno.h>
 
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_access.h>
 #include <vlc_dialog.h>
 #include <vlc_input_item.h>
-
 #include <vlc_network.h>
 #include <vlc_url.h>
 #include <vlc_tls.h>
 #include <vlc_sout.h>
 #include <vlc_charset.h>
+#include <vlc_interrupt.h>
 
 #ifndef IPPORT_FTP
 # define IPPORT_FTP 21u
@@ -830,11 +830,17 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
     if( p_sys->data.p_tls != NULL )
         i_read = vlc_tls_Read( p_sys->data.p_tls, p_buffer, i_len, false );
     else
-        i_read = net_Read( p_access, p_sys->data.fd, p_buffer, i_len, false );
+        i_read = vlc_recv_i11e( p_sys->data.fd, p_buffer, i_len, 0 );
+
     if( i_read == 0 )
         p_access->info.b_eof = true;
     else if( i_read > 0 )
         p_access->info.i_pos += i_read;
+    else if( errno != EINTR && errno != EAGAIN )
+    {
+        msg_Err( p_access, "receive error: %s", vlc_strerror_c(errno) );
+        p_access->info.b_eof = true;
+    }
 
     return i_read;
 }



More information about the vlc-commits mailing list