summaryrefslogtreecommitdiff
path: root/gio/gtrashportal.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-12-10 15:16:33 -0500
committerMatthias Clasen <mclasen@redhat.com>2019-12-10 15:16:33 -0500
commitc3ab139841efa0b994ccbf78fe06faf713875bc3 (patch)
tree4cd8ae9c048ffc1166f4c5055577832dc2050927 /gio/gtrashportal.c
parentf3de395812542eb9abb8c4ea7f8181140ed2f0b0 (diff)
downloadglib-c3ab139841efa0b994ccbf78fe06faf713875bc3.tar.gz
trash portal: Don't follow symlinks
We got a complaint here that trashing via the portal deletes the target of a symlink, not the symlink itself. It turns out that following the symlink already happens on the glib side. https://github.com/flatpak/xdg-desktop-portal/issues/412
Diffstat (limited to 'gio/gtrashportal.c')
-rw-r--r--gio/gtrashportal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gio/gtrashportal.c b/gio/gtrashportal.c
index b6aca37a6..9922be21f 100644
--- a/gio/gtrashportal.c
+++ b/gio/gtrashportal.c
@@ -86,10 +86,10 @@ g_trash_portal_trash_file (GFile *file,
path = g_file_get_path (file);
- fd = g_open (path, O_RDWR | O_CLOEXEC);
+ 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);
+ fd = g_open (path, O_PATH | O_CLOEXEC | O_RDONLY | O_NOFOLLOW);
errsv = errno;