summaryrefslogtreecommitdiff
path: root/daemon/trashlib
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2016-10-11 10:41:49 +0200
committerOndrej Holy <oholy@redhat.com>2016-11-07 13:32:31 +0100
commit897f516d888e9a5962d66b332982e1c9381d6035 (patch)
tree27ecaf3d8fca9dc813af6b1e7a9ed4f1d5fbb6da /daemon/trashlib
parentc7b85b3184bead3f1a0dee9bc7c468722b0d3507 (diff)
downloadgvfs-897f516d888e9a5962d66b332982e1c9381d6035.tar.gz
trash: Do not crash if home mount isn't found
Mount entry might not be found e.g. for bind mounts, btrfs subvolumes. Let's assume that the home trash is on filesystem with trusted notifications. https://bugzilla.gnome.org/show_bug.cgi?id=747540
Diffstat (limited to 'daemon/trashlib')
-rw-r--r--daemon/trashlib/trashwatcher.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/daemon/trashlib/trashwatcher.c b/daemon/trashlib/trashwatcher.c
index f1196a3f..64470236 100644
--- a/daemon/trashlib/trashwatcher.c
+++ b/daemon/trashlib/trashwatcher.c
@@ -68,6 +68,12 @@ decide_watch_type (GUnixMountEntry *mount,
const gchar *fs_type;
const gchar *mount_path;
+ /* Let's assume that home trash is trusted if mount wasn't found.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=747540
+ */
+ if (mount == NULL)
+ return TRASH_WATCHER_TRUSTED;
+
mount_path = g_unix_mount_get_mount_path (mount);
/* Do not care about mount points without read access to avoid polling, see:
@@ -113,10 +119,15 @@ find_mount_entry_for_file (GFile *file)
g_free (pathname);
- /* if the GUnixMount stuff is gummed up, this might fail. we can't
- * really proceed, since decide_watch_type() needs to know this.
+ /* Entry might not be found e.g. for bind mounts, btrfs subvolumes...
+ * https://bugzilla.gnome.org/show_bug.cgi?id=747540
*/
- g_assert (entry != NULL);
+ if (entry == NULL)
+ {
+ pathname = g_file_get_path (file);
+ g_warning ("Mount entry was not found for %s", pathname);
+ g_free (pathname);
+ }
return entry;
}
@@ -277,7 +288,8 @@ trash_watcher_new (TrashRoot *root)
g_get_user_data_dir (),
"Trash/files");
- g_unix_mount_free (homedir_mount);
+ if (homedir_mount)
+ g_unix_mount_free (homedir_mount);
g_object_unref (homedir_trashdir);
g_object_unref (user_datadir);