configure: fix for the cases where bison provides yacc
[fio.git] / memory.c
index e06cab2900a531e1515308fb166e626b6076274f..8c06d94d85e7a48ecfb5d8681a8780658f567f6c 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -158,9 +158,10 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem)
        if (td->orig_buffer == MAP_FAILED) {
                td_verror(td, errno, "mmap");
                td->orig_buffer = NULL;
-               if (td->mmapfd) {
+               if (td->mmapfd != 1) {
                        close(td->mmapfd);
-                       unlink(td->o.mmapfile);
+                       if (td->o.mmapfile)
+                               unlink(td->o.mmapfile);
                }
 
                return 1;
@@ -209,7 +210,7 @@ int allocate_io_mem(struct thread_data *td)
 
        total_mem = td->orig_buffer_size;
 
-       if (td->o.odirect || td->o.mem_align ||
+       if (td->o.odirect || td->o.mem_align || td->o.oatomic ||
            (td->io_ops->flags & FIO_MEMALIGN)) {
                total_mem += page_mask;
                if (td->o.mem_align && td->o.mem_align > page_size)
@@ -240,7 +241,7 @@ void free_io_mem(struct thread_data *td)
        unsigned int total_mem;
 
        total_mem = td->orig_buffer_size;
-       if (td->o.odirect)
+       if (td->o.odirect || td->o.oatomic)
                total_mem += page_mask;
 
        if (td->o.mem_type == MEM_MALLOC)