Now _rtld_relocate_objects() returns with error as soon as any of

subsequent calls in it fails.

Spotted by wiz and enami.
This commit is contained in:
junyoung 2002-11-22 04:39:37 +00:00
parent f528c56f39
commit 2cc0cde8f5

View File

@ -1,4 +1,4 @@
/* $NetBSD: reloc.c,v 1.75 2002/11/21 19:09:56 junyoung Exp $ */
/* $NetBSD: reloc.c,v 1.76 2002/11/22 04:39:37 junyoung Exp $ */
/*
* Copyright 1996 John D. Polstra.
@ -153,7 +153,6 @@ _rtld_relocate_objects(first, bind_now)
bool bind_now;
{
Obj_Entry *obj;
int res;
for (obj = first; obj != NULL; obj = obj->next) {
if (obj->nbuckets == 0 || obj->nchains == 0 ||
@ -183,7 +182,8 @@ _rtld_relocate_objects(first, bind_now)
}
}
dbg(("doing non-PLT relocations"));
res = _rtld_relocate_nonplt_objects(obj);
if (_rtld_relocate_nonplt_objects(obj) < 0)
return -1;
if (obj->textrel) { /* Re-protected the text segment. */
if (mprotect(obj->mapbase, obj->textsize,
PROT_READ | PROT_EXEC) == -1) {
@ -193,14 +193,13 @@ _rtld_relocate_objects(first, bind_now)
}
}
dbg(("doing lazy PLT binding"));
res = _rtld_relocate_plt_lazy(obj);
if (_rtld_relocate_plt_lazy(obj) < 0)
return -1;
#if defined(__i386__)
if (bind_now)
res = _rtld_relocate_plt_objects(obj);
if (_rtld_relocate_plt_objects(obj) < 0)
return -1;
#endif
if (res < 0)
return -1;
/* Set some sanity-checking numbers in the Obj_Entry. */
obj->magic = RTLD_MAGIC;