[vlc-devel] [PATCH] Udev SD: Try to find out the mount point for blu-ray discs.

Rémi Denis-Courmont remi at remlab.net
Wed Feb 15 15:07:13 CET 2012


On Wed, 15 Feb 2012 17:33:06 +0400, Konstantin Pavlov
<thresh at videolan.org>
wrote:
> ---
>  modules/services_discovery/udev.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/modules/services_discovery/udev.c
> b/modules/services_discovery/udev.c
> index 56b42e2..f1bb490 100644
> --- a/modules/services_discovery/udev.c
> +++ b/modules/services_discovery/udev.c
> @@ -34,6 +34,7 @@
>  #endif
>  #include <poll.h>
>  #include <errno.h>
> +#include <mntent.h>
>  
>  static int OpenV4L (vlc_object_t *);
>  #ifdef HAVE_ALSA
> @@ -576,6 +577,20 @@ static char *disc_get_mrl (struct udev_device *dev)
>          return NULL;
>  
>      val = udev_device_get_devnode (dev);
> +
> +    if (!strcmp (scheme, "bluray"))
> +    {
> +        FILE* mtab = setmntent ("/etc/mtab", "r");

I ma not sure, but I would think /proc/self/mounts should be used instead.

> +        struct mntent* m;
> +        struct mntent mbuf;
> +        char buf [8192];
> +        while ((m = getmntent_r (mtab, &mbuf, buf, sizeof(buf))) !=
NULL)
> +        {
> +            if( !strcmp (m->mnt_fsname, val)) val = m->mnt_dir;
> +        }
> +        endmntent (mtab);
> +    }
> +
>      return make_URI (val, scheme);

This looks like use-after-release to me.

>  }

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list