[glib: 2/4] gio: don't pass O_PATH descriptors to the document portal
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/4] gio: don't pass O_PATH descriptors to the document portal
- Date: Mon, 28 Jan 2019 12:58:27 +0000 (UTC)
commit 9dc0d6bfa546bd4de95c214ec16a761026e5c420
Author: James Henstridge <james jamesh id au>
Date: Tue Jan 15 16:21:35 2019 +0800
gio: don't pass O_PATH descriptors to the document portal
Like for the OpenURI portal, O_PATH file descriptors do not prove access
to the underlying file data. I've used O_RDWR file descriptors here to
mirror the requested read/write permissions.
gio/gdocumentportal.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gio/gdocumentportal.c b/gio/gdocumentportal.c
index 56378b1e6..13c4f67bd 100644
--- a/gio/gdocumentportal.c
+++ b/gio/gdocumentportal.c
@@ -31,9 +31,6 @@
#include "gunixfdlist.h"
#endif
-#ifndef O_PATH
-#define O_PATH 0
-#endif
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#else
@@ -112,7 +109,7 @@ g_document_portal_add_document (GFile *file,
}
path = g_file_get_path (file);
- fd = g_open (path, O_PATH | O_CLOEXEC);
+ fd = g_open (path, O_RDWR | O_CLOEXEC);
errsv = errno;
if (fd == -1)
@@ -210,7 +207,7 @@ g_document_portal_add_documents (GList *uris,
{
int fd;
- fd = g_open (path, O_CLOEXEC | O_PATH);
+ fd = g_open (path, O_CLOEXEC | O_RDWR);
if (fd >= 0)
{
#ifndef HAVE_O_CLOEXEC
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]