Just to be on the safe side: no longer tries to load non-loadable segments.

Improved error output in case something goes wrong.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8598 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-08-18 00:22:57 +00:00
parent 9705d07a5d
commit 6cd4801539

View File

@ -25,7 +25,6 @@
#include <elf_priv.h> #include <elf_priv.h>
#include <boot/elf.h> #include <boot/elf.h>
#include <malloc.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -1074,6 +1073,9 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry)
char *regionAddress; char *regionAddress;
region_id id; region_id id;
if (pheaders[i].p_type != PT_LOAD)
continue;
regionAddress = (char *)ROUNDOWN(pheaders[i].p_vaddr, PAGE_SIZE); regionAddress = (char *)ROUNDOWN(pheaders[i].p_vaddr, PAGE_SIZE);
if (pheaders[i].p_flags & PF_WRITE) { if (pheaders[i].p_flags & PF_WRITE) {
/* /*
@ -1094,7 +1096,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry)
B_READ_AREA | B_WRITE_AREA, REGION_PRIVATE_MAP, B_READ_AREA | B_WRITE_AREA, REGION_PRIVATE_MAP,
path, ROUNDOWN(pheaders[i].p_offset, PAGE_SIZE)); path, ROUNDOWN(pheaders[i].p_offset, PAGE_SIZE));
if (id < 0) { if (id < 0) {
dprintf("error allocating region!\n"); dprintf("error allocating region: %s!\n", strerror(id));
err = B_NOT_AN_EXECUTABLE; err = B_NOT_AN_EXECUTABLE;
goto error; goto error;
} }