Commit 0e96c458 authored by Konstantin Pavlov's avatar Konstantin Pavlov

bluray: check setmntent return value.

(cherry picked from commit b73e9de8)
Signed-off-by: Konstantin Pavlov's avatarKonstantin Pavlov <thresh@videolan.org>
parent e0b8acf1
......@@ -297,17 +297,19 @@ static void FindMountPoint(char **file)
struct stat st;
if (lstat (bd_device, &st) == 0 && S_ISBLK (st.st_mode)) {
FILE *mtab = setmntent ("/proc/self/mounts", "r");
struct mntent *m, mbuf;
char buf [8192];
while ((m = getmntent_r (mtab, &mbuf, buf, sizeof(buf))) != NULL) {
if (!strcmp (m->mnt_fsname, bd_device)) {
free(device);
*file = strdup(m->mnt_dir);
break;
if (mtab) {
struct mntent *m, mbuf;
char buf [8192];
while ((m = getmntent_r (mtab, &mbuf, buf, sizeof(buf))) != NULL) {
if (!strcmp (m->mnt_fsname, bd_device)) {
free(device);
*file = strdup(m->mnt_dir);
break;
}
}
endmntent (mtab);
}
endmntent (mtab);
}
free(bd_device);
......
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