[package] util-linux: update to 2.21.2
[openwrt.git] / tools / e2fsprogs / patches / 005-posix_memalign.patch
1 --- a/lib/ext2fs/ext2fs.h
2 +++ b/lib/ext2fs/ext2fs.h
3 @@ -1212,7 +1212,26 @@
4  
5         if (align == 0)
6                 align = 8;
7 -       if (retval = posix_memalign((void **) ptr, align, size)) {
8 +#ifdef HAVE_POSIX_MEMALIGN
9 +       retval = posix_memalign((void **)ptr, align, size);
10 +#else
11 +#ifdef HAVE_MEMALIGN
12 +    if ((*(void **)ptr = (void *)memalign(align, size)) == NULL)
13 +       retval = errno;
14 +    else
15 +       retval = 0;
16 +#else
17 +#ifdef HAVE_VALLOC
18 +    if ((*(void **)ptr = valloc(size)) == NULL)
19 +       retval = errno;
20 +    else
21 +       retval = 0;
22 +#else
23 +# error "Impossible to allocate aligned memory!"
24 +#endif /* HAVE_VALLOC */
25 +#endif /* HAVE_MEMALIGN */
26 +#endif /* HAVE_POSIX_MEMALIGN */
27 +       if (retval) {
28                 if (retval == ENOMEM)
29                         return EXT2_ET_NO_MEMORY;
30                 return retval;
31 --