package/libglib2: fix build with glibc >= 2.34
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sat, 4 Sep 2021 22:31:15 +0000 (00:31 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Sat, 11 Sep 2021 17:07:39 +0000 (19:07 +0200)
Fix the following build failure with glibc >= 2.34:

../glib/gspawn.c: In function 'safe_closefrom':
../glib/gspawn.c:1497:7: error: too few arguments to function 'close_range'
 1497 |   if (close_range (lowfd, G_MAXUINT) != 0 && errno == ENOSYS)
      |       ^~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/cbc0913fa2cc486deb64b07b5b13341a5a97025e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Tested-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
package/libglib2/0004-correctly-use-3-parameters-for-close_range.patch [new file with mode: 0644]

diff --git a/package/libglib2/0004-correctly-use-3-parameters-for-close_range.patch b/package/libglib2/0004-correctly-use-3-parameters-for-close_range.patch
new file mode 100644 (file)
index 0000000..bfca4b1
--- /dev/null
@@ -0,0 +1,33 @@
+From b71117d89434db83d34bc1b981ca03d4be299576 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 8 Jul 2021 17:26:43 -0700
+Subject: [PATCH] correctly use 3 parameters for close_range
+
+libc implementation has 3 parameter e.g.
+https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2&format=html
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+[Retrieved from:
+https://gitlab.gnome.org/GNOME/glib/-/commit/b71117d89434db83d34bc1b981ca03d4be299576]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ glib/gspawn.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/glib/gspawn.c b/glib/gspawn.c
+index 899647c2f..3073a10a4 100644
+--- a/glib/gspawn.c
++++ b/glib/gspawn.c
+@@ -1520,7 +1520,7 @@ safe_closefrom (int lowfd)
+    *
+    * Handle ENOSYS in case it’s supported in libc but not the kernel; if so,
+    * fall back to safe_fdwalk(). */
+-  if (close_range (lowfd, G_MAXUINT) != 0 && errno == ENOSYS)
++  if (close_range (lowfd, G_MAXUINT, 0) != 0 && errno == ENOSYS)
+ #endif  /* HAVE_CLOSE_RANGE */
+   (void) safe_fdwalk (close_func, GINT_TO_POINTER (lowfd));
+ #endif
+-- 
+GitLab
+