about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedlibc.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-01-29 20:37:08 +0100
committerptitSeb <sebastien.chev@gmail.com>2025-01-29 20:37:08 +0100
commit1db09fe897b79b6cdbb7fb9af7a9570c949d0d79 (patch)
tree93e62a610a39b0e7d70118c7b2a0d6bf74c713d8 /src/wrapped/wrappedlibc.c
parent22a5b573d5cff6ff0c7d1f4ec7646136c4de8445 (diff)
downloadbox64-1db09fe897b79b6cdbb7fb9af7a9570c949d0d79.tar.gz
box64-1db09fe897b79b6cdbb7fb9af7a9570c949d0d79.zip
More improvmnet to map with fd tracking
Diffstat (limited to 'src/wrapped/wrappedlibc.c')
-rw-r--r--src/wrapped/wrappedlibc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 71d811f2..181a8c8b 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -3006,14 +3006,14 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int f
                 if((BOX64ENV(log)>=LOG_DEBUG || BOX64ENV(dynarec_log)>=LOG_DEBUG)) {printf_log(LOG_NONE, "Note: Marking the region (%p-%p prot=%x) as NEVERCLEAN because fd have O_RDWR attribute\n", ret, ret+length, prot);}
                 prot |= PROT_NEVERCLEAN;
             }
-            if(emu) {
-                DetectUnityPlayer(fd);
-                // the last_mmap will allow mmap created by wine, even those that have hole, to be fully tracked as one single mmap
-                if((ret>=last_mmap_addr) && ret+length<(last_mmap_addr+last_mmap_len))
-                    RecordEnvMappings((uintptr_t)last_mmap_addr, last_mmap_len, fd);
-                else
-                    RecordEnvMappings((uintptr_t)ret, length, fd);
-            }
+        }
+        if(emu && !(flags&MAP_ANONYMOUS) && (fd>0)) {
+            DetectUnityPlayer(fd);
+            // the last_mmap will allow mmap created by wine, even those that have hole, to be fully tracked as one single mmap
+            if((ret>=last_mmap_addr) && ret+length<(last_mmap_addr+last_mmap_len))
+                RecordEnvMappings((uintptr_t)last_mmap_addr, last_mmap_len, fd);
+            else
+                RecordEnvMappings((uintptr_t)ret, length, fd);
         }
         // hack to capture full size of the mmap done by wine
         if(emu && (fd==-1) && (flags==(MAP_PRIVATE|MAP_ANON))) {