LibC: mmap() should not interpret high addresses as errors, oops!
This commit is contained in:
parent
c3d36a5fe9
commit
0b1b21d622
Notes:
sideshowbarker
2024-07-19 15:41:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0b1b21d6228
1 changed files with 5 additions and 1 deletions
|
@ -9,7 +9,11 @@ void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
|
|||
{
|
||||
Syscall::SC_mmap_params params { (dword)addr, size, prot, flags, fd, offset };
|
||||
int rc = syscall(SC_mmap, ¶ms);
|
||||
__RETURN_WITH_ERRNO(rc, (void*)rc, (void*)-1);
|
||||
if (rc < 0 && -rc < EMAXERRNO) {
|
||||
errno = -rc;
|
||||
return (void*)-1;
|
||||
}
|
||||
return (void*)rc;
|
||||
}
|
||||
|
||||
int munmap(void* addr, size_t size)
|
||||
|
|
Loading…
Add table
Reference in a new issue