summaryrefslogtreecommitdiff
path: root/daemon/trashlib/trashwatcher.c
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2016-09-16 15:31:12 +0200
committerOndrej Holy <oholy@redhat.com>2016-10-14 11:13:35 +0200
commit6c0adcce5a3f5b784e198ce9cf2af6aaa540a264 (patch)
treeee43b5b84258a223b99edbce9b1e973504b6d6e1 /daemon/trashlib/trashwatcher.c
parentf9980674a83901bfb679e94e2ca596822407febc (diff)
downloadgvfs-6c0adcce5a3f5b784e198ce9cf2af6aaa540a264.tar.gz
trash: Correctly determine fs type for paths with symlinks
If, for example, "/home" is a symlink to "/mnt/home", and the users's $HOME is "/home/user", then the code won't correctly recognize unix mount, because it just walks up the path removing trailing components. Consequently, "/" is used to determine filesystem type instead of "/mnt/home". It will cause problems if "/mnt/home" is e.g. NFS, which is handled differently than local filesystem. It uses newly added g_unix_mount_for. Bump GLib dependency accordingly. https://bugzilla.gnome.org/show_bug.cgi?id=771431
Diffstat (limited to 'daemon/trashlib/trashwatcher.c')
-rw-r--r--daemon/trashlib/trashwatcher.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/daemon/trashlib/trashwatcher.c b/daemon/trashlib/trashwatcher.c
index f1196a3f..5520eb57 100644
--- a/daemon/trashlib/trashwatcher.c
+++ b/daemon/trashlib/trashwatcher.c
@@ -95,22 +95,7 @@ find_mount_entry_for_file (GFile *file)
char *pathname;
pathname = g_file_get_path (file);
- do
- {
- char *slash;
-
- slash = strrchr (pathname, '/');
-
- /* leave the leading '/' in place */
- if (slash == pathname)
- slash++;
-
- *slash = '\0';
-
- entry = g_unix_mount_at (pathname, NULL);
- }
- while (entry == NULL && pathname[1]);
-
+ entry = g_unix_mount_for (pathname, NULL);
g_free (pathname);
/* if the GUnixMount stuff is gummed up, this might fail. we can't