Revert "glocalfile: Check that parent device is the same when trashing"

This reverts commit 15cdcd2e0b4d18487dc71e3adc85e3bc8090058a.
This commit is contained in:
Iain Lane 2018-08-13 17:23:10 +01:00
parent 438547641f
commit 93f3cb7c6d
2 changed files with 7 additions and 27 deletions

View File

@ -1677,20 +1677,16 @@ find_mountpoint_for (const char *file,
}
}
static char *
_g_local_file_find_topdir_for_internal (const char *file, dev_t file_dev)
char *
_g_local_file_find_topdir_for (const char *file)
{
char *dir;
char *mountpoint = NULL;
dev_t dir_dev;
dir = get_parent (file, &dir_dev);
if (dir == NULL || dir_dev != file_dev)
{
g_free (dir);
return NULL;
}
if (dir == NULL)
return NULL;
mountpoint = find_mountpoint_for (dir, dir_dev);
g_free (dir);
@ -1698,17 +1694,6 @@ _g_local_file_find_topdir_for_internal (const char *file, dev_t file_dev)
return mountpoint;
}
char *
_g_local_file_find_topdir_for (const char *file)
{
GStatBuf file_stat;
if (g_lstat (file, &file_stat) != 0)
return NULL;
return _g_local_file_find_topdir_for_internal (file, file_stat.st_dev);
}
static char *
get_unique_filename (const char *basename,
int id)
@ -1962,8 +1947,7 @@ g_local_file_trash (GFile *file,
uid = geteuid ();
g_snprintf (uid_str, sizeof (uid_str), "%lu", (unsigned long)uid);
topdir = _g_local_file_find_topdir_for_internal (local->filename,
file_stat.st_dev);
topdir = _g_local_file_find_topdir_for (local->filename);
if (topdir == NULL)
{
g_set_io_error (error,

View File

@ -924,13 +924,9 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher,
_g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_DELETE,
writable);
/* Trashing is supported only if the parent device is the same */
if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_TRASH))
_g_file_info_set_attribute_boolean_by_id (info,
G_FILE_ATTRIBUTE_ID_ACCESS_CAN_TRASH,
writable &&
parent_info->has_trash_dir &&
parent_info->device == statbuf->st_dev);
_g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_TRASH,
writable && parent_info->has_trash_dir);
}
}