Commit b73e9de8 authored by Konstantin Pavlov's avatar Konstantin Pavlov

bluray: check setmntent return value.

parent 1384565a
......@@ -299,17 +299,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