From 4a995ddae8b12d20efc2367ad4e1c9b159f96eed Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 30 Oct 2014 08:40:47 -0600 Subject: [PATCH] mmap: set 'fd' to -1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This looks like a typo, using '1' makes no sense. This fixes Solaris anon allocs. Reported-by: Sébastien Bouchex Bellomié Signed-off-by: Jens Axboe --- memory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/memory.c b/memory.c index 8c06d94d..76da8a86 100644 --- a/memory.c +++ b/memory.c @@ -119,7 +119,7 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem) { int flags = 0; - td->mmapfd = 1; + td->mmapfd = -1; if (td->o.mem_type == MEM_MMAPHUGE) { unsigned long mask = td->o.hugepage_size - 1; @@ -176,7 +176,8 @@ static void free_mem_mmap(struct thread_data *td, size_t total_mem) td->orig_buffer); munmap(td->orig_buffer, td->orig_buffer_size); if (td->o.mmapfile) { - close(td->mmapfd); + if (td->mmapfd != -1) + close(td->mmapfd); unlink(td->o.mmapfile); free(td->o.mmapfile); } -- 2.25.1