pkgsrc-wip/grub2/patches/patch-ak
Blair Sadewitz aa02c6605b - Clean up package Makefile/*.mk files.
- Update/refactor patches to match current CVS.
- Added hacks.mk for sanity.
- Proper PLIST segmentation/consistency.
- Use CONF_FILES framework.
- Bump rev.
2007-11-20 05:56:10 +00:00

27 lines
778 B
Text

$NetBSD: patch-ak,v 1.5 2007/11/20 05:56:10 bsadewitz Exp $
--- util/misc.c.orig 2007-10-21 08:29:33.000000000 -0400
+++ util/misc.c
@@ -36,6 +36,9 @@
memalign is declared in malloc.h in all systems, if present. */
#ifdef HAVE_MEMALIGN
# include <malloc.h>
+# if !defined(posix_memalign) && defined(__NetBSD__)
+int posix_memalign(void **memptr, size_t alignment, size_t size);
+# endif
#endif
char *progname = 0;
@@ -242,7 +245,11 @@ grub_memalign (grub_size_t align, grub_s
#elif defined(HAVE_MEMALIGN)
p = memalign (align, size);
#else
- grub_util_error ("grub_memalign is not supported");
+ p = malloc (size + align - 1);
+ if (p)
+ p = (void *)(((int)p/align + 1) * align);
+ else
+ grub_util_error ("out of memory");
#endif
if (! p)