summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2022-02-28 17:37:43 +0100
committerChristian Persch <chpe@src.gnome.org>2022-02-28 17:58:27 +0100
commit5770e39b5a908952237bc8288e5342eb08c1d5bb (patch)
treed78cbb88ce3d21bb0f50d1777f517b502153cb38
parentf4b915aea367d407f8ac527e1aed9425b8cea9e2 (diff)
downloadvte-5770e39b5a908952237bc8288e5342eb08c1d5bb.tar.gz
spawn: Fix build without CLOSE_RANGE_CLOEXEC
Only call close_range() when CLOSE_RANGE_CLOEXEC is defined. Fixes the build on non-linux. Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/2544
-rw-r--r--src/spawn.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/spawn.cc b/src/spawn.cc
index fd0ec654..e231105c 100644
--- a/src/spawn.cc
+++ b/src/spawn.cc
@@ -68,6 +68,7 @@ set_cloexec_cb(void* data,
static int
cloexec_from(int fd)
{
+#ifdef CLOSE_RANGE_CLOEXEC
/* First, try close_range(CLOEXEC) which is faster than the methods
* below, and works even if /proc is not available.
*/
@@ -78,6 +79,7 @@ cloexec_from(int fd)
errno != ENOSYS /* old kernel, or not supported on this platform */ &&
errno != EINVAL /* flags not supported */)
return res;
+#endif /* CLOSE_RANGE_CLOEXEC */
/* Fall back to fdwalk */
return fdwalk(set_cloexec_cb, &fd);