mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Fix trashing sandboxed directories
We must not open the fd with O_PATH|O_NOFOLLOW, since the portal rejects that combination. Leaving out O_NOFOLLOW is fine in this case - we know it is a directory, we just received EISDIR. Fixes: #2629
This commit is contained in:
parent
db76697aee
commit
724df43616
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user