about summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorBrent W. Baccala <cosine@freesoft.org>2016-10-31 17:31:56 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-10-31 17:32:25 +0100
commit561ff1ec4251c8dca011dbcf7500b3970b2cf59b (patch)
tree3c6da59beb07a3673b496ee82cd282944a41fc29 /sysdeps/mach
parent44c637ce806cc41534e89117a93c41fd310e7e3f (diff)
downloadglibc-561ff1ec4251c8dca011dbcf7500b3970b2cf59b.tar.gz
glibc-561ff1ec4251c8dca011dbcf7500b3970b2cf59b.tar.xz
glibc-561ff1ec4251c8dca011dbcf7500b3970b2cf59b.zip
hurd: Fix spurious port deallocation
* sysdeps/mach/hurd/dl-sysdep.c (__mmap): Do not deallocate memobj_wr
when it is MACH_PORT_NULL.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c3
1 files changed, 2 insertions, 1 deletions
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;