[gtk/matthiasc/for-master] file transfer: Fix build on non-Linux
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] file transfer: Fix build on non-Linux
- Date: Mon, 16 Dec 2019 16:39:08 +0000 (UTC)
commit 721595edeaf270268b282769f9e91b6c40be4f75
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Dec 16 11:28:21 2019 -0500
file transfer: Fix build on non-Linux
O_PATH and O_CLOEXEC are not universally available.
gdk/filetransferportal.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/gdk/filetransferportal.c b/gdk/filetransferportal.c
index 97e4134651..ff9c799674 100644
--- a/gdk/filetransferportal.c
+++ b/gdk/filetransferportal.c
@@ -26,6 +26,16 @@
#include <gio/gio.h>
#include <gio/gunixfdlist.h>
+#ifndef O_PATH
+#define O_PATH 0
+#endif
+
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#else
+#define HAVE_O_CLOEXEC 1
+#endif
+
#include "filetransferportalprivate.h"
static GDBusProxy *file_transfer_proxy = NULL;
@@ -158,6 +168,10 @@ add_files (GDBusProxy *proxy,
g_object_unref (fd_list);
return;
}
+
+#ifndef HAVE_O_CLOEXEC
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
+#endif
fd_in = g_unix_fd_list_append (fd_list, fd, &error);
close (fd);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]