hfsprogs: Fix compilation with uClibc-ng
authorRosen Penev <rosenp@gmail.com>
Sun, 5 May 2019 22:31:38 +0000 (15:31 -0700)
committerRosen Penev <rosenp@gmail.com>
Tue, 23 Jul 2019 03:15:11 +0000 (20:15 -0700)
Replaced deprecated and unsupported valloc with posix_memalign.

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

utils/hfsprogs/Makefile
utils/hfsprogs/patches/010-valloc-to-memalign.patch [new file with mode: 0644]

index 9300fbc0a79a5ebf3ea7b07553422d73b097c515..e5184280e9fa1b512a8f686de32e656a982a78e0 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hfsprogs
 PKG_VERSION:=332.25
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_LICENSE:=GPL-3.0+
 PKG_LICENSE_FILES:=COPYING
diff --git a/utils/hfsprogs/patches/010-valloc-to-memalign.patch b/utils/hfsprogs/patches/010-valloc-to-memalign.patch
new file mode 100644 (file)
index 0000000..c391e1d
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/newfs_hfs.tproj/makehfs.c
++++ b/newfs_hfs.tproj/makehfs.c
+@@ -376,7 +376,7 @@ make_hfsplus(const DriveInfo *driveInfo, hfsparams_t *defaults)
+       if ( (temp & 0x01FF) != 0 )
+               temp = (temp + kBytesPerSector) & 0xFFFFFE00;
+       
+-      nodeBuffer = valloc((size_t)temp);
++      (void)posix_memalign(&nodeBuffer, sysconf(_SC_PAGESIZE), (size_t)temp);
+       if (nodeBuffer == NULL)
+               err(1, NULL);
+@@ -1814,7 +1814,7 @@ ClearDisk(const DriveInfo *driveInfo, UInt64 startingSector, UInt32 numberOfSect
+       bufferSize = bufferSizeInSectors << kLog2SectorSize;
+-      tempBuffer = valloc((size_t)bufferSize);
++      (void)posix_memalign(&tempBuffer, sysconf(_SC_PAGESIZE), (size_t)bufferSize);
+       if (tempBuffer == NULL)
+               err(1, NULL);