xfsprogs: Replace valloc with posix_memalign
authorRosen Penev <rosenp@gmail.com>
Mon, 6 May 2019 21:57:18 +0000 (14:57 -0700)
committerPetr Štetiar <ynezz@true.cz>
Wed, 14 Aug 2019 07:12:52 +0000 (09:12 +0200)
Fixes compilation under uClibc-ng.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
(cherry picked from commit e49b6bb61828b8b903db0ef48113b4065a215c63)

package/utils/xfsprogs/Makefile
package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch [new file with mode: 0644]

index 50a5147b047c7f4f73e6923df2866eccc3a8ff2f..353773840ad01488209e52cc316e564e998828d8 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=xfsprogs
 PKG_CPE_ID:=cpe:/a:sgi:xfsprogs
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_VERSION:=4.11.0
 PKG_SOURCE_URL:=@KERNEL/linux/utils/fs/xfs/xfsprogs
 PKG_HASH:=c3a6d87b564d7738243c507df82276bed982265e345363a95f2c764e8a5f5bb2
diff --git a/package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch b/package/utils/xfsprogs/patches/130-db-malloc-Use-posix_memalign-instead-of-deprecated-v.patch
new file mode 100644 (file)
index 0000000..7bf1c77
--- /dev/null
@@ -0,0 +1,31 @@
+From 930f9aa8f08759fa739dd6e615ba8b3a1890008d Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Mon, 6 May 2019 13:56:13 -0700
+Subject: [PATCH] db/malloc: Use posix_memalign instead of deprecated valloc
+
+valloc is not available with uClibc-ng as well as being deprecated, which
+causes compilation errors. aligned_alloc is not available before C11 so
+used posix_memalign.'
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ db/malloc.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/db/malloc.c b/db/malloc.c
+index 77b3e022..38fe0b05 100644
+--- a/db/malloc.c
++++ b/db/malloc.c
+@@ -56,8 +56,7 @@ xmalloc(
+ {
+       void    *ptr;
+-      ptr = valloc(size);
+-      if (ptr)
++      if(!posix_memalign(&ptr, sysconf(_SC_PAGESIZE), size))
+               return ptr;
+       badmalloc();
+       /* NOTREACHED */
+-- 
+2.17.1
+