diff options
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/mmap_anon.c | 7 | ||||
-rw-r--r-- | osdep/mmap_anon.h | 2 |
2 files changed, 3 insertions, 6 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; } diff --git a/osdep/mmap_anon.h b/osdep/mmap_anon.h index edb909bdc0..e0f2d4e1ed 100644 --- a/osdep/mmap_anon.h +++ b/osdep/mmap_anon.h @@ -3,6 +3,6 @@ #include <sys/types.h> -void *mmap_anon(void *, size_t, int, int, int *, off_t); +void *mmap_anon(void *, size_t, int, int, off_t); #endif /* _OSDEP_MMAP_ANON_H_ */ |