[vlc-commits] commit: FTP: fix relative file paths (fix #3984) ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Mon Aug 2 20:43:27 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug  2 21:42:22 2010 +0300| [0ad85b8520873e54cd1e11c3494f0ec621497404] | committer: Rémi Denis-Courmont 

FTP: fix relative file paths (fix #3984)

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

 modules/access/ftp.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index ca50e0c..127ee35 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -303,11 +303,16 @@ static int parseURL( vlc_url_t *url, const char *path )
     if( url->i_port <= 0 )
         url->i_port = IPPORT_FTP; /* default port */
 
+    if( url->psz_path == NULL )
+        return VLC_SUCCESS;
     /* FTP URLs are relative to user's default directory (RFC1738 §3.2)
     For absolute path use ftp://foo.bar//usr/local/etc/filename */
     /* FIXME: we should issue a series of CWD, one per slash */
-    if( url->psz_path == NULL )
-        return VLC_SUCCESS;
+    if( url->psz_path )
+    {
+        assert( url->psz_path[0] == '/' );
+        url->psz_path++;
+    }
 
     char *type = strstr( url->psz_path, ";type=" );
     if( type )



More information about the vlc-commits mailing list