summaryrefslogtreecommitdiffstats
path: root/tools/e2fsprogs
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-06-07 15:24:33 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-06-07 15:24:33 +0000
commit9c88d96f7e529b22b3e9558656cdc00a27f2579f (patch)
tree94a0ee2eeb227782233cd746ff8a2fe669373cef /tools/e2fsprogs
parent5aab29d8a1afcaccb2462d79ad127076577b1969 (diff)
e2fsprogs: add posix_memalign related portability patch from #8508
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32112 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/e2fsprogs')
-rw-r--r--tools/e2fsprogs/patches/005-posix_memalign.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/e2fsprogs/patches/005-posix_memalign.patch b/tools/e2fsprogs/patches/005-posix_memalign.patch
new file mode 100644
index 000000000..2ce4ead89
--- /dev/null
+++ b/tools/e2fsprogs/patches/005-posix_memalign.patch
@@ -0,0 +1,31 @@
+--- a/lib/ext2fs/ext2fs.h
++++ b/lib/ext2fs/ext2fs.h
+@@ -1212,7 +1212,26 @@
+
+ if (align == 0)
+ align = 8;
+- if (retval = posix_memalign((void **) ptr, align, size)) {
++#ifdef HAVE_POSIX_MEMALIGN
++ retval = posix_memalign((void **)ptr, align, size);
++#else
++#ifdef HAVE_MEMALIGN
++ if ((*(void **)ptr = (void *)memalign(align, size)) == NULL)
++ retval = errno;
++ else
++ retval = 0;
++#else
++#ifdef HAVE_VALLOC
++ if ((*(void **)ptr = valloc(size)) == NULL)
++ retval = errno;
++ else
++ retval = 0;
++#else
++# error "Impossible to allocate aligned memory!"
++#endif /* HAVE_VALLOC */
++#endif /* HAVE_MEMALIGN */
++#endif /* HAVE_POSIX_MEMALIGN */
++ if (retval) {
+ if (retval == ENOMEM)
+ return EXT2_ET_NO_MEMORY;
+ return retval;
+--