Commit e89f07d3 authored by pbrook's avatar pbrook
Browse files

Make target_mmap always return -1 on failure.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1741 c046a42c-6fe2-441c-8c8c-71466251a162
parent 06c949e6
...@@ -890,7 +890,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex, ...@@ -890,7 +890,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
interpreter_fd, interpreter_fd,
eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr)); eppnt->p_offset - TARGET_ELF_PAGEOFFSET(eppnt->p_vaddr));
if (error > -1024UL) { if (error == -1) {
/* Real error */ /* Real error */
close(interpreter_fd); close(interpreter_fd);
free(elf_phdata); free(elf_phdata);
......
...@@ -183,8 +183,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot, ...@@ -183,8 +183,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
} }
#endif #endif
if (offset & ~TARGET_PAGE_MASK) if (offset & ~TARGET_PAGE_MASK) {
return -EINVAL; errno = EINVAL;
return -1;
}
len = TARGET_PAGE_ALIGN(len); len = TARGET_PAGE_ALIGN(len);
if (len == 0) if (len == 0)
...@@ -232,8 +234,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot, ...@@ -232,8 +234,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
} }
} }
if (start & ~TARGET_PAGE_MASK) if (start & ~TARGET_PAGE_MASK) {
return -EINVAL; errno = EINVAL;
return -1;
}
end = start + len; end = start + len;
host_end = HOST_PAGE_ALIGN(end); host_end = HOST_PAGE_ALIGN(end);
...@@ -244,8 +248,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot, ...@@ -244,8 +248,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
/* msync() won't work here, so we return an error if write is /* msync() won't work here, so we return an error if write is
possible while it is a shared mapping */ possible while it is a shared mapping */
if ((flags & MAP_TYPE) == MAP_SHARED && if ((flags & MAP_TYPE) == MAP_SHARED &&
(prot & PROT_WRITE)) (prot & PROT_WRITE)) {
return -EINVAL; errno = EINVAL;
return -1;
}
retaddr = target_mmap(start, len, prot | PROT_WRITE, retaddr = target_mmap(start, len, prot | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0); -1, 0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment