From 84172a2e26fd81c1c39b6301b003cc89b97ee75c Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun, 9 Nov 2014 22:38:22 +0100
Subject: Deal with odd kernel behavior

Some versions of gnumach actually take address as a mapping hint, and would fail
if the hint is bogus.  Make sure to pass 0 for those versions.

* libstore/memobj.c (memobj_read): Make sure to set *buf to 0 before
calling vm_map.
---
 libstore/memobj.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstore/memobj.c b/libstore/memobj.c
index 0d5c816e..cc6c7cac 100644
--- a/libstore/memobj.c
+++ b/libstore/memobj.c
@@ -133,6 +133,7 @@ memobj_read (struct store *store,
   if (((size_t) addr & (vm_page_size - 1)) == 0)
     {
       *len = amount;
+      *buf = 0;
       return vm_map (mach_task_self (), (vm_address_t *) buf, amount,
 		     0, 1, store->port, addr << store->log2_block_size, 0,
 		     VM_PROT_READ, VM_PROT_ALL, VM_INHERIT_NONE);
-- 
cgit v1.2.3