vlc | branch: master | Konstantin Pavlov <[email protected]> | Tue Dec 26 
02:03:31 2017 +0300| [b73e9de8812273ef295398a7aa3e41a5d73899ae] | committer: 
Konstantin Pavlov

bluray: check setmntent return value.

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

 modules/access/bluray.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 990caba88e..478bb5ae78 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -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);
 

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to