Package: aoeui
Severity: important
Tags: patch

Dear Maintainer,

aoeui currently fails to build from source on hurd-i386:
buffer.c:(.text+0x55f): undefined reference to `mremap'

mremap() is Linux-specific.

Using a fake_mremap() function, as it is done in lrzip, seems to fix the issue 
(see the attached patch).

WBR,
Cyril Roelandt.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: hurd-i386 (i686-AT386)

Kernel: GNU-Mach 1.3.99/Hurd-0.3
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
diff --git a/buffer.c b/buffer.c
index ebec0da..2501e03 100644
--- a/buffer.c
+++ b/buffer.c
@@ -23,6 +23,16 @@
  *	and for undo histories.
  */
 
+#ifndef __linux__
+static inline void *fake_mremap(void *old_address, size_t old_size, size_t new_size, int flags)
+{
+	(void) flags;
+	munmap(old_address, old_size);
+	return mmap(old_address, new_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+}
+#define mremap fake_mremap
+#endif
+
 struct buffer *buffer_create(char *path)
 {
 	struct buffer *buffer = allocate0(sizeof *buffer);

Reply via email to