[vlc-devel] [PATCH 1/3] file: fix directory subitems type
Rémi Denis-Courmont
remi at remlab.net
Wed Nov 4 22:00:29 CET 2015
Le 2015-11-04 21:35, Thomas Guillem a écrit :
> @@ -111,6 +121,38 @@ void DirClose( vlc_object_t * p_this )
> free (p_sys);
> }
>
> +static bool DirIsLooping (access_t *p_access, const char *uri)
> +{
> +#ifdef S_ISLNK
> + struct stat st;
> + bool looping = false;
> +
> + if (vlc_lstat (uri, &st) != 0)
> + return false;
> + if (S_ISLNK (st.st_mode))
> + {
> + char *link = malloc (st.st_size + 1);
> +
> + if (link)
> + {
> + ssize_t ret = readlink (uri, link, st.st_size + 1);
> + if (ret > 0 && ret <= st.st_size)
> + {
> + link[ret] = '\0';
> + if (strstr (p_access->psz_filepath, link))
> + looping = true;
> + }
> + free (link);
> + }
> + }
> + return looping;
> +#else
> + VLC_UNUSED (p_access);
> + VLC_UNUSED (uri);
> + return false;
> +#endif
> +}
> +
The loop check was never fully correct (you could turn a regular file
into a directory). And now that we no longer do recursion within the
directory plugin, the check seems rather vain to me. In practice the
playlist shall limit the depth of recursion.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list