mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 16:26:17 +01:00
Merge branch 'trash-check' into 'master'
trash portal: Fix permission checks See merge request GNOME/glib!704
This commit is contained in:
commit
4d04353bbd
@ -37,6 +37,10 @@
|
|||||||
#define HAVE_O_CLOEXEC 1
|
#define HAVE_O_CLOEXEC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef O_PATH
|
||||||
|
#define O_PATH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
static GXdpTrash *
|
static GXdpTrash *
|
||||||
ensure_trash_portal (void)
|
ensure_trash_portal (void)
|
||||||
{
|
{
|
||||||
@ -83,9 +87,9 @@ g_trash_portal_trash_file (GFile *file,
|
|||||||
path = g_file_get_path (file);
|
path = g_file_get_path (file);
|
||||||
|
|
||||||
fd = g_open (path, O_RDWR | O_CLOEXEC);
|
fd = g_open (path, O_RDWR | O_CLOEXEC);
|
||||||
if (fd == -1 && (errno == EACCES || errno == EISDIR))
|
if (fd == -1 && errno == EISDIR)
|
||||||
/* If we don't have write access, fall back to read-only */
|
/* If it is a directory, fall back to O_PATH */
|
||||||
fd = g_open (path, O_CLOEXEC | O_RDONLY);
|
fd = g_open (path, O_PATH | O_CLOEXEC | O_RDONLY);
|
||||||
|
|
||||||
errsv = errno;
|
errsv = errno;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user