From: Daniel Colascione Date: Fri, 21 Mar 2014 07:27:26 +0000 (-0700) Subject: Do not allow a dumped Emacs to be dumped X-Git-Tag: emacs-25.0.90~2640^2~344^2~26^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f58269c4b2961208ed94c4dfb028186fd53675a3;p=emacs.git Do not allow a dumped Emacs to be dumped --- f58269c4b2961208ed94c4dfb028186fd53675a3 diff --cc src/ChangeLog index d2572e74048,d2572e74048..fa6d2650528 --- a/src/ChangeLog +++ b/src/ChangeLog @@@ -1,3 -1,3 +1,12 @@@ ++2014-03-21 Daniel Colascione ++ ++ Always prohibit dumping a dumped Emacs. ++ ++ * emacs.c (might_dump): New variable. ++ (Fdump_emacs): Always prohibit dumping of dumped Emacs. ++ * lisp.h (might_dump): Declare. ++ * unexcw.c (unexec): Remove now-redundant multiple-dump detection code. ++ 2014-03-20 Paul Eggert * doc.c (store_function_docstring): Fix pointer signedness mismatch. diff --cc src/emacs.c index fd93324de97,fd93324de97..3f0d3c43cc6 --- a/src/emacs.c +++ b/src/emacs.c @@@ -121,6 -121,6 +121,9 @@@ Lisp_Object Vlibrary_cache on subsequent starts. */ bool initialized; ++/* Set to true if this instance of Emacs might dump. */ ++bool might_dump; ++ #ifdef DARWIN_OS extern void unexec_init_emacs_zone (void); #endif @@@ -1631,6 -1631,6 +1634,10 @@@ Using an Emacs configured with --with-x #endif #endif ++#ifndef CANNOT_DUMP ++ might_dump = !initialized; ++#endif ++ initialized = 1; #ifdef LOCALTIME_CACHE @@@ -2082,6 -2082,6 +2089,9 @@@ You must run Emacs in batch mode in ord if (! noninteractive) error ("Dumping Emacs works only in batch mode"); ++ if (!might_dump) ++ error ("Emacs can be dumped only once"); ++ #ifdef GNU_LINUX /* Warn if the gap between BSS end and heap start is larger than this. */ diff --cc src/lisp.h index 2f9a30fdfe9,2f9a30fdfe9..df8f3120a8e --- a/src/lisp.h +++ b/src/lisp.h @@@ -800,6 -800,6 +800,7 @@@ extern _Noreturn Lisp_Object wrong_type /* Defined in emacs.c. */ extern bool initialized; ++extern bool might_dump; /* Defined in eval.c. */ extern Lisp_Object Qautoload; diff --cc src/unexcw.c index fcca5e5cbf2,fcca5e5cbf2..25d13ca0ca4 --- a/src/unexcw.c +++ b/src/unexcw.c @@@ -286,13 -286,13 +286,6 @@@ unexec (const char *outfile, const cha int ret; int ret2; -- if (bss_sbrk_did_unexec) -- { -- /* can only dump once */ -- printf ("You can only dump Emacs once on this platform.\n"); -- return; -- } -- report_sheap_usage (1); infile = add_exe_suffix_if_necessary (infile, infile_buffer);