Commit d2fbc302 authored by Sam Lade's avatar Sam Lade Committed by Jean-Baptiste Kempf

Bluray: fix playback when device is a symlink

(cherry picked from commit 21e4928a6b98fd7b6bb520b5f1b863738a695295)
(cherry picked from commit 3e7cc6f5762510082bc4e7301ad9a4ed2bb6de77)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 2c5cab2a
...@@ -183,13 +183,17 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -183,13 +183,17 @@ static int blurayOpen( vlc_object_t *object )
struct mntent* m; struct mntent* m;
struct mntent mbuf; struct mntent mbuf;
char buf [8192]; 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) { 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)); strncpy (bd_path, m->mnt_dir, sizeof(bd_path));
bd_path[sizeof(bd_path) - 1] = '\0'; bd_path[sizeof(bd_path) - 1] = '\0';
break; break;
} }
} }
free(bd_device);
endmntent (mtab); endmntent (mtab);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment