summaryrefslogtreecommitdiffstats
path: root/osdep/mmap_anon.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/mmap_anon.c')
-rw-r--r--osdep/mmap_anon.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/osdep/mmap_anon.c b/osdep/mmap_anon.c
index b6d0b7cf35..484615311a 100644
--- a/osdep/mmap_anon.c
+++ b/osdep/mmap_anon.c
@@ -31,7 +31,7 @@
* \param zerofd
* \return a pointer to the mapped region upon successful completion, -1 otherwise.
*/
-void *mmap_anon(void *addr, size_t len, int prot, int flags, int *zerofd, off_t offset)
+void *mmap_anon(void *addr, size_t len, int prot, int flags, off_t offset)
{
int fd;
void *result;
@@ -46,7 +46,6 @@ void *mmap_anon(void *addr, size_t len, int prot, int flags, int *zerofd, off_t
#ifdef MAP_ANONYMOUS
/* BSD-style anonymous mapping */
- fd = -1;
result = mmap(addr, len, prot, flags | MAP_ANONYMOUS, -1, offset);
#else
/* SysV-style anonymous mapping */
@@ -57,11 +56,9 @@ void *mmap_anon(void *addr, size_t len, int prot, int flags, int *zerofd, off_t
}
result = mmap(addr, len, prot, flags, fd, offset);
+ close(fd);
#endif /* MAP_ANONYMOUS */
- if (zerofd)
- *zerofd = fd;
-
return result;
}