X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Funexcw.c;h=81a38b19868222aad82fc00396e6e96b991a8e1d;hb=1d0f965ba499c40eb5b24415c62ec0dc2b0b8ff7;hp=eced85b6eab1658be8643b5dbef0adca831eedd1;hpb=3062d425fac0473eb5aa2efc0bb002f6ce0cb028;p=chise%2Fxemacs-chise.git.1 diff --git a/src/unexcw.c b/src/unexcw.c index eced85b..81a38b1 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -37,7 +37,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #define PERROR(arg) perror(arg);exit(-1) -#ifndef HAVE_A_OUT_H +#if !defined(HAVE_A_OUT_H) && !defined(WIN32_NATIVE) unexec (char *, char *, void *, void *, void *) { PERROR("cannot unexec() a.out.h not installed"); @@ -47,8 +47,14 @@ unexec (char *, char *, void *, void *, void *) #ifndef MAX_PATH #define MAX_PATH 260 #endif + +#ifdef MINGW +#include <../../include/a.out.h> +#else #include +#endif +#define STACK_SIZE 0x800000 #define ALLOC_UNIT 0xFFFF #define ALLOC_MASK ~((unsigned long)(ALLOC_UNIT)) #define ALIGN_ALLOC(addr) \ @@ -335,6 +341,9 @@ copy_executable_and_dump_data_section (int a_out, int a_new) } f_ohdr.dsize=new_data_size; f_ohdr.bsize=BSS_PAD_SIZE; + /* Prevent stack overflow with regexp usage. */ + f_ohdr.SizeOfStackReserve = STACK_SIZE; + if (write(a_new, &f_ohdr, sizeof(f_ohdr)) != sizeof(f_ohdr)) { PERROR("failed to write optional header");