mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-17 11:00:08 +00:00
Discern MAP_ANONYMOUS the proper way on NT
We were checking for anonymous mappings earlier on Windows by seeing if the file descriptor argument to mmap() was supplied as -1. This was not correct. The proper thing to do is check `flags & MAP_ANONYMOUS`.
This commit is contained in:
parent
390aee960a
commit
0d084d01b9
1 changed files with 3 additions and 3 deletions
|
@ -38,10 +38,10 @@ textwindows struct DirectMap sys_mmap_nt(void *addr, size_t size, int prot,
|
||||||
struct ProtectNt fl;
|
struct ProtectNt fl;
|
||||||
const struct NtSecurityAttributes *sec;
|
const struct NtSecurityAttributes *sec;
|
||||||
|
|
||||||
if (fd != -1) {
|
if (flags & MAP_ANONYMOUS) {
|
||||||
handle = g_fds.p[fd].handle;
|
|
||||||
} else {
|
|
||||||
handle = kNtInvalidHandleValue;
|
handle = kNtInvalidHandleValue;
|
||||||
|
} else {
|
||||||
|
handle = g_fds.p[fd].handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & MAP_TYPE) != MAP_SHARED) {
|
if ((flags & MAP_TYPE) != MAP_SHARED) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue