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
This commit is contained in:
Ondrej Holy 2018-06-05 09:04:20 +02:00
parent d1eaf72c00
commit 13e751cab4

View File

@ -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) &&