[vlc-devel] [PATCH] ftp: fix directory listing with legacy server

Rémi Denis-Courmont remi at remlab.net
Wed May 20 17:50:00 CEST 2020


Le keskiviikkona 20. toukokuuta 2020, 16.21.46 EEST Felix Paul Kühne a écrit :
> From: Felix Paul Kühne <felix at feepk.net>
> 
> A legacy ftp server included in macOS 10.6 and earlier tried to be clever
> and gives the keys as Uppercase so VLC failed to determine the item type.

The existing code does not look right and this patch makes it marginally worse 
as strcasestr() is locale-dependent.

> ---
>  modules/access/ftp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/access/ftp.c b/modules/access/ftp.c
> index 0118ec7d9e..45da6edf1c 100644
> --- a/modules/access/ftp.c
> +++ b/modules/access/ftp.c
> @@ -936,9 +936,9 @@ static int DirRead (stream_t *p_access,
> input_item_node_t *p_current_node) if( p_sys->features.b_mlst )
>          {
>              /* MLST Format is key=val;key=val...; FILENAME */
> -            if( strstr( psz_line, "type=dir" ) )
> +            if( strcasestr( psz_line, "type=dir" ) )
>                  type = ITEM_TYPE_DIRECTORY;
> -            if( strstr( psz_line, "type=file" ) )
> +            if( strcasestr( psz_line, "type=file" ) )
>                  type = ITEM_TYPE_FILE;
> 
>              /* Get the filename or fail */


-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list