From dc631aa511c80e6dad3f4fee5c4cb66d65334c2f Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sun, 6 Dec 2020 08:37:39 +0100 Subject: [PATCH] Windows: fix compilation, CLOEXEC does not exist --- libdocument/ev-file-helpers.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c index b0abb3a7..78c0374e 100644 --- a/libdocument/ev-file-helpers.c +++ b/libdocument/ev-file-helpers.c @@ -39,6 +39,11 @@ static gchar *tmp_dir = NULL; #define O_BINARY 0 #endif +/* On Windows, O_CLOEXEC does not exist */ +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + /* * ev_dir_ensure_exists: * @dir: the directory name @@ -513,6 +518,10 @@ static const char *compressor_cmds[] = { static void compression_child_setup_cb (gpointer fd_ptr) { +#ifdef _WIN32 + /* On Windows, processes are not inherited by default */ + (void)fd_ptr; +#else int fd = GPOINTER_TO_INT (fd_ptr); int flags; @@ -521,6 +530,7 @@ compression_child_setup_cb (gpointer fd_ptr) flags &= ~FD_CLOEXEC; fcntl (fd, F_SETFD, flags); } +#endif } static gchar *