[vte/vte-0-68] spawn: Fix build without CLOSE_RANGE_CLOEXEC



commit 22c815f3556450b37596bad48f03aef48d397f45
Author: Christian Persch <chpe src gnome org>
Date:   Mon Feb 28 17:37:43 2022 +0100

    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
    (cherry picked from commit 5770e39b5a908952237bc8288e5342eb08c1d5bb)

 src/spawn.cc | 2 ++
 1 file changed, 2 insertions(+)
---
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]