From 561ff1ec4251c8dca011dbcf7500b3970b2cf59b Mon Sep 17 00:00:00 2001 From: "Brent W. Baccala" Date: Mon, 31 Oct 2016 17:31:56 +0100 Subject: hurd: Fix spurious port deallocation * sysdeps/mach/hurd/dl-sysdep.c (__mmap): Do not deallocate memobj_wr when it is MACH_PORT_NULL. --- sysdeps/mach/hurd/dl-sysdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sysdeps/mach') diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 76140cf093..d730f82280 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -473,7 +473,8 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) err = __io_map ((mach_port_t) fd, &memobj_rd, &memobj_wr); if (err) return __hurd_fail (err), MAP_FAILED; - __mach_port_deallocate (__mach_task_self (), memobj_wr); + if (memobj_wr != MACH_PORT_NULL) + __mach_port_deallocate (__mach_task_self (), memobj_wr); } mapaddr = (vm_address_t) addr; -- cgit v1.2.3