Merge branch 'backport-2583-portal-trashing-dirs-glib-2-72' into 'glib-2-72'

Backport !2583 “Fix trashing sandboxed directories” to glib-2-72

See merge request GNOME/glib!2587
This commit is contained in:
Simon McVittie
2022-04-05 14:18:02 +00:00

View File

@@ -89,8 +89,12 @@ g_trash_portal_trash_file (GFile *file,
fd = g_open (path, O_RDWR | O_CLOEXEC | O_NOFOLLOW);
if (fd == -1 && errno == EISDIR)
/* If it is a directory, fall back to O_PATH */
fd = g_open (path, O_PATH | O_CLOEXEC | O_RDONLY | O_NOFOLLOW);
/* If it is a directory, fall back to O_PATH.
* Remove O_NOFOLLOW since
* a) we know it is a directory, not a symlink, and
* b) the portal reject this combination
*/
fd = g_open (path, O_PATH | O_CLOEXEC | O_RDONLY);
errsv = errno;