Petri Hintukainen pushed to branch master at VideoLAN / libaacs


Commits:
e3e53062 by hpi1 at 2020-07-06T17:20:56+03:00
Increase error loglevel

- - - - -
5f58595f by hpi1 at 2020-07-06T17:22:40+03:00
mmc_device_darwin: Attempt to fix #6 (segfault in close() after failed open())

- - - - -


1 changed file:

- src/file/mmc_device_darwin.c


Changes:

=====================================
src/file/mmc_device_darwin.c
=====================================
@@ -371,13 +371,13 @@ static DADissenterRef iokit_mount_approval_cb(DADiskRef 
disk, void *context)
 static int iokit_da_init(MMCDEV *mmc) {
     mmc->session = DASessionCreate(kCFAllocatorDefault);
     if (NULL == mmc->session) {
-        BD_DEBUG(DBG_MMC, "Could not create a disc arbitration session\n");
+        BD_DEBUG(DBG_MMC | DBG_CRIT, "Could not create a disc arbitration 
session\n");
         return -1;
     }
 
     mmc->disk = DADiskCreateFromBSDName(kCFAllocatorDefault, mmc->session, 
mmc->bsd_name);
     if (NULL == mmc->disk) {
-        BD_DEBUG(DBG_MMC, "Could not create a disc arbitration disc for the 
device\n");
+        BD_DEBUG(DBG_MMC | DBG_CRIT, "Could not create a disc arbitration disc 
for the device\n");
         CFRelease(mmc->session);
         mmc->session = NULL;
         return -1;
@@ -429,14 +429,14 @@ static int mmc_open_iokit(const char *path, MMCDEV *mmc) {
     /* get the bsd name associated with this mount */
     rc = get_mounted_device_from_path(mmc, path);
     if (0 != rc) {
-        BD_DEBUG(DBG_MMC, "Could not locate mounted device associated with 
%s\n", path);
+        BD_DEBUG(DBG_MMC | DBG_CRIT, "Could not locate mounted device 
associated with %s\n", path);
         return rc;
     }
 
     /* find a matching io service (IOBDServices) */
     rc = iokit_find_service_matching(mmc, &service);
     if (0 != rc) {
-        BD_DEBUG(DBG_MMC, "Could not find matching IOBDServices mounted @ 
%s\n", path);
+        BD_DEBUG(DBG_MMC | DBG_CRIT, "Could not find matching IOBDServices 
mounted @ %s\n", path);
         return rc;
     }
 
@@ -463,7 +463,7 @@ static int mmc_open_iokit(const char *path, MMCDEV *mmc) {
     /* finally, obtain exclusive access */
     rc = (*mmc->taskInterface)->ObtainExclusiveAccess(mmc->taskInterface);
     if (kIOReturnSuccess != rc) {
-        BD_DEBUG(DBG_MMC, "Failed to obtain exclusive access. rc = %x\n", rc);
+        BD_DEBUG(DBG_MMC | DBG_CRIT, "Failed to obtain exclusive access. rc = 
%x\n", rc);
         return -1;
     }
 
@@ -533,6 +533,12 @@ void device_close(MMCDEV **pp)
             IODestroyPlugInInterface(mmc->plugInInterface);
         }
 
+        if (!mmc->sync_sem) {
+            /* open failed before iokit_da_init() */
+            X_FREE(*pp);
+            return;
+        }
+
         /* Wait for disc to re-appear for 20 seconds.
          * This timeout was figured out by experimentation with
          * a USB BD drive which sometimes can take really long to



View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/compare/a2703d885b2dfed2f5bbae999070ad9f01dc2369...5f58595ff4a19d645c482ded6877e9ac10e23952

-- 
View it on GitLab: 
https://code.videolan.org/videolan/libaacs/-/compare/a2703d885b2dfed2f5bbae999070ad9f01dc2369...5f58595ff4a19d645c482ded6877e9ac10e23952
You're receiving this email because of your account on code.videolan.org.


_______________________________________________
libaacs-devel mailing list
libaacs-devel@videolan.org
https://mailman.videolan.org/listinfo/libaacs-devel

Reply via email to