[glib: 2/6] glocalfile: Update G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic



commit 13e751cab4f7d341ec0719b70767a975c57cd333
Author: Ondrej Holy <oholy redhat com>
Date:   Tue Jun 5 09:04:20 2018 +0200

    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

 gio/glocalfile.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
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) &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]