[vlc-devel] [PATCH] Udev SD: Try to find out the mount point for blu-ray discs.
Konstantin Pavlov
thresh at videolan.org
Wed Feb 15 16:37:56 CET 2012
On Wed, Feb 15, 2012 at 03:07:13PM +0100, Rémi Denis-Courmont wrote:
> 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.
Yes, you are right. /etc/mtab is a symlink to /proc/mounts for me for a
long time anyway, and it will be like that on most desktop systems when
systemd is fully adopted, too. ;)
> > + 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.
Uhm, why?
Updated patch attached.
--
Konstantin Pavlov
VideoLAN team
-------------- next part --------------
>From 11799c484687cc2e8d1631c5c37100b55f91b26e Mon Sep 17 00:00:00 2001
From: Konstantin Pavlov <thresh at videolan.org>
Date: Wed, 15 Feb 2012 16:30:38 +0400
Subject: [PATCH] Udev SD: Try to find out the mount point for blu-ray discs.
---
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..5c86399 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 ("/proc/self/mounts", "r");
+ 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);
}
--
1.7.8.4
More information about the vlc-devel
mailing list