From: Jens Axboe Date: Thu, 30 Oct 2014 14:40:47 +0000 (-0600) Subject: mmap: set 'fd' to -1 X-Git-Tag: fio-2.1.14~19 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=4a995ddae8b12d20efc2367ad4e1c9b159f96eed;p=fio.git mmap: set 'fd' to -1 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 --- 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); }