[gvfs] common: Check BDMV folder before libblueray usage



commit c1ffe8d4abb75dad5615006152da3eb130362a45
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Jun 22 10:05:58 2016 +0200

    common: Check BDMV folder before libblueray usage
    
    You can see the following errors from libblueray if you insert
    non-blueray disk:
    disc.c:350: error opening file BDMV/index.bdmv
    disc.c:350: error opening file BDMV/BACKUP/index.bdmv
    
    Unfortunately bd_set_debug_mask is not part of public API, so we
    have no control over the output. Let's do not use any libblueray
    API functions if BDMV dir does not exists to avoid such errors.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767909

 common/gvfsmountinfo.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/common/gvfsmountinfo.c b/common/gvfsmountinfo.c
index 2c36551..ca4d868 100644
--- a/common/gvfsmountinfo.c
+++ b/common/gvfsmountinfo.c
@@ -481,6 +481,7 @@ bdmv_metadata_thread (GSimpleAsyncResult *result,
   char *icon;
   char *name;
   const char *lang;
+  char *path;
 
   file = G_FILE (object);
 
@@ -493,6 +494,16 @@ bdmv_metadata_thread (GSimpleAsyncResult *result,
       goto error;
     }
 
+  path = g_build_filename (disc_root, "BDMV", NULL);
+  if (!g_file_test (path, G_FILE_TEST_IS_DIR))
+    {
+      error = g_error_new_literal (G_IO_ERROR,
+                                   G_IO_ERROR_FAILED,
+                                   "Device is not a Blu-Ray disc");
+      goto error;
+    }
+  g_free (path);
+
   bd = bd_open (disc_root, NULL);
   g_free (disc_root);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]