summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2018-06-05 09:04:20 +0200
committerOndrej Holy <oholy@redhat.com>2018-06-05 10:52:57 +0200
commitf0b655fb8cc7a68190bd1a64ce8fe6b00abc0341 (patch)
tree38e500aef41a6a45ec1dc7c2ff7b4d56df515150
parentc246e332fd4bb7d88137b14ce6e69a02028d2a33 (diff)
downloadglib-f0b655fb8cc7a68190bd1a64ce8fe6b00abc0341.tar.gz
glocalfile: Update G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic
Change G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic to be consistent with recent g_local_file_trash changes, i.e. set this to FALSE for locations on system-internal mounts. https://gitlab.gnome.org/GNOME/glib/issues/251
-rw-r--r--gio/glocalfile.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 52e0ec294..aff15a982 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1769,6 +1769,7 @@ _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev)
char uid_str[32];
GStatBuf global_stat, trash_stat;
gboolean res;
+ GUnixMountEntry *mount;
if (g_once_init_enter (&home_dev_set))
{
@@ -1787,6 +1788,16 @@ _g_local_file_has_trash_dir (const char *dirname, dev_t dir_dev)
if (topdir == NULL)
return FALSE;
+ mount = g_unix_mount_at (topdir, NULL);
+ if (mount == NULL || g_unix_mount_is_system_internal (mount))
+ {
+ g_clear_pointer (&mount, g_unix_mount_free);
+
+ return FALSE;
+ }
+
+ g_clear_pointer (&mount, g_unix_mount_free);
+
globaldir = g_build_filename (topdir, ".Trash", NULL);
if (g_lstat (globaldir, &global_stat) == 0 &&
S_ISDIR (global_stat.st_mode) &&