aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/unexelf.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/unexelf.c b/src/unexelf.c
index 1cdcfeb44e4..756de5835ce 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -58,9 +58,11 @@ what you give them. Help stamp out software-hoarding! */
58#include <sys/types.h> 58#include <sys/types.h>
59#include <unistd.h> 59#include <unistd.h>
60 60
61#if !defined (__NetBSD__) && !defined (__OpenBSD__) 61#ifdef __QNX__
62#include <elf.h> 62# include <sys/elf.h>
63#endif /* not __NetBSD__ and not __OpenBSD__ */ 63#elif !defined __NetBSD__ && !defined __OpenBSD__
64# include <elf.h>
65#endif
64#include <sys/mman.h> 66#include <sys/mman.h>
65#if defined (_SYSTYPE_SYSV) 67#if defined (_SYSTYPE_SYSV)
66#include <sys/elf_mips.h> 68#include <sys/elf_mips.h>
@@ -222,7 +224,6 @@ unexec (const char *new_name, const char *old_name)
222{ 224{
223 int new_file, old_file; 225 int new_file, old_file;
224 off_t new_file_size; 226 off_t new_file_size;
225 void *new_break;
226 227
227 /* Pointers to the base of the image of the two files. */ 228 /* Pointers to the base of the image of the two files. */
228 caddr_t old_base, new_base; 229 caddr_t old_base, new_base;
@@ -326,11 +327,13 @@ unexec (const char *new_name, const char *old_name)
326 if (old_bss_index == -1) 327 if (old_bss_index == -1)
327 fatal ("no bss section found"); 328 fatal ("no bss section found");
328 329
330 void *no_break = (void *) (intptr_t) -1;
331 void *new_break = no_break;
329#ifdef HAVE_SBRK 332#ifdef HAVE_SBRK
330 new_break = sbrk (0); 333 new_break = sbrk (0);
331#else
332 new_break = (byte *) old_bss_addr + old_bss_size;
333#endif 334#endif
335 if (new_break == no_break)
336 new_break = (byte *) old_bss_addr + old_bss_size;
334 new_bss_addr = (ElfW (Addr)) new_break; 337 new_bss_addr = (ElfW (Addr)) new_break;
335 bss_size_growth = new_bss_addr - old_bss_addr; 338 bss_size_growth = new_bss_addr - old_bss_addr;
336 new_data2_size = bss_size_growth; 339 new_data2_size = bss_size_growth;