[vlc-commits] Bluray: fix playback when device is a symlink

Sam Lade git at videolan.org
Sun Jun 3 23:35:33 CEST 2012


vlc/vlc-2.0 | branch: master | Sam Lade <sam at sentynel.com> | Sun Jun  3 16:57:00 2012 +0200| [d2fbc302dec84a3129f70e7cb647901290301b34] | committer: Jean-Baptiste Kempf

Bluray: fix playback when device is a symlink

(cherry picked from commit 21e4928a6b98fd7b6bb520b5f1b863738a695295)
(cherry picked from commit 3e7cc6f5762510082bc4e7301ad9a4ed2bb6de77)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/access/bluray.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index ad80202..14a6fe7 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -183,13 +183,17 @@ static int blurayOpen( vlc_object_t *object )
             struct mntent* m;
             struct mntent mbuf;
             char buf [8192];
+            /* bd_path may be a symlink (e.g. /dev/dvd -> /dev/sr0), so make
+             * sure we look up the real device */
+            char* bd_device = realpath(bd_path, NULL);
             while ((m = getmntent_r (mtab, &mbuf, buf, sizeof(buf))) != NULL) {
-                if (!strcmp (m->mnt_fsname, bd_path)) {
+                if (!strcmp (m->mnt_fsname, (bd_device == NULL ? bd_path : bd_device))) {
                     strncpy (bd_path, m->mnt_dir, sizeof(bd_path));
                     bd_path[sizeof(bd_path) - 1] = '\0';
                     break;
                 }
             }
+            free(bd_device);
             endmntent (mtab);
         }
     }



More information about the vlc-commits mailing list