summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2010-06-14 20:12:44 +0200
committerArnel A. Borja <arnelborja@src.gnome.org>2013-08-31 00:56:44 +0800
commitf074233ef077b6bd172d057493fc4c64cf3a0775 (patch)
tree35707e45327617c67412594b01498110658c2fb1
parented5e03aaeee3aa1c23dff1f1c384aa67b33ec21a (diff)
downloadlibmediaart-f074233ef077b6bd172d057493fc4c64cf3a0775.tar.gz
libtracker-miner: support GMounts without GVolume in mount_guess_content_type()
-rw-r--r--src/libtracker-miner/tracker-storage.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/libtracker-miner/tracker-storage.c b/src/libtracker-miner/tracker-storage.c
index c2e6c28..31f9eaa 100644
--- a/src/libtracker-miner/tracker-storage.c
+++ b/src/libtracker-miner/tracker-storage.c
@@ -355,8 +355,6 @@ mount_guess_content_type (GFile *mount_root,
GUnixMountEntry *entry;
gchar *content_type = NULL;
gchar *mount_path;
- gchar *device_path;
- const gchar *filesystem_type = NULL;
gchar **guess_type;
gint i;
@@ -386,23 +384,30 @@ mount_guess_content_type (GFile *mount_root,
entry = g_unix_mount_at (mount_path, NULL);
if (entry) {
+ const gchar *filesystem_type;
+ gchar *device_path = NULL;
+
filesystem_type = g_unix_mount_get_fs_type (entry);
g_debug (" Using filesystem type:'%s'",
filesystem_type);
- device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
-
- g_debug (" Using device path:'%s'",
- device_path);
+ /* Volume may be NULL */
+ if (volume) {
+ device_path = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
+ g_debug (" Using device path:'%s'",
+ device_path);
+ }
if (strcmp (filesystem_type, "udf") == 0 ||
strcmp (filesystem_type, "iso9660") == 0 ||
strcmp (filesystem_type, "cd9660") == 0 ||
- g_str_has_prefix (device_path, "/dev/cdrom") ||
- g_str_has_prefix (device_path, "/dev/acd") ||
- g_str_has_prefix (device_path, "/dev/cd")) {
+ (device_path &&
+ (g_str_has_prefix (device_path, "/dev/cdrom") ||
+ g_str_has_prefix (device_path, "/dev/acd") ||
+ g_str_has_prefix (device_path, "/dev/cd")))) {
*is_optical = TRUE;
- } else if (g_str_has_prefix (device_path, "/vol/")) {
+ } else if (device_path &&
+ g_str_has_prefix (device_path, "/vol/")) {
const gchar *name;
name = mount_path + strlen ("/");