diff options
| author | Daniel Colascione | 2014-03-21 00:27:26 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2014-03-21 00:27:26 -0700 |
| commit | f58269c4b2961208ed94c4dfb028186fd53675a3 (patch) | |
| tree | 47e154bee86b5d669c88abc5f8bcefec9881fe9e /src | |
| parent | aa3a7b515abc46f0ff2f55c144e4806456bc1934 (diff) | |
| parent | 6ce1b56e2a92232a055fd777378ebdbab8f07d1a (diff) | |
| download | emacs-f58269c4b2961208ed94c4dfb028186fd53675a3.tar.gz emacs-f58269c4b2961208ed94c4dfb028186fd53675a3.zip | |
Do not allow a dumped Emacs to be dumped
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/emacs.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/unexcw.c | 7 |
4 files changed, 20 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d2572e74048..fa6d2650528 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-03-21 Daniel Colascione <dancol@dancol.org> | ||
| 2 | |||
| 3 | Always prohibit dumping a dumped Emacs. | ||
| 4 | |||
| 5 | * emacs.c (might_dump): New variable. | ||
| 6 | (Fdump_emacs): Always prohibit dumping of dumped Emacs. | ||
| 7 | * lisp.h (might_dump): Declare. | ||
| 8 | * unexcw.c (unexec): Remove now-redundant multiple-dump detection code. | ||
| 9 | |||
| 1 | 2014-03-20 Paul Eggert <eggert@cs.ucla.edu> | 10 | 2014-03-20 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 11 | ||
| 3 | * doc.c (store_function_docstring): Fix pointer signedness mismatch. | 12 | * doc.c (store_function_docstring): Fix pointer signedness mismatch. |
diff --git a/src/emacs.c b/src/emacs.c index fd93324de97..3f0d3c43cc6 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -121,6 +121,9 @@ Lisp_Object Vlibrary_cache; | |||
| 121 | on subsequent starts. */ | 121 | on subsequent starts. */ |
| 122 | bool initialized; | 122 | bool initialized; |
| 123 | 123 | ||
| 124 | /* Set to true if this instance of Emacs might dump. */ | ||
| 125 | bool might_dump; | ||
| 126 | |||
| 124 | #ifdef DARWIN_OS | 127 | #ifdef DARWIN_OS |
| 125 | extern void unexec_init_emacs_zone (void); | 128 | extern void unexec_init_emacs_zone (void); |
| 126 | #endif | 129 | #endif |
| @@ -1631,6 +1634,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1631 | #endif | 1634 | #endif |
| 1632 | #endif | 1635 | #endif |
| 1633 | 1636 | ||
| 1637 | #ifndef CANNOT_DUMP | ||
| 1638 | might_dump = !initialized; | ||
| 1639 | #endif | ||
| 1640 | |||
| 1634 | initialized = 1; | 1641 | initialized = 1; |
| 1635 | 1642 | ||
| 1636 | #ifdef LOCALTIME_CACHE | 1643 | #ifdef LOCALTIME_CACHE |
| @@ -2082,6 +2089,9 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2082 | if (! noninteractive) | 2089 | if (! noninteractive) |
| 2083 | error ("Dumping Emacs works only in batch mode"); | 2090 | error ("Dumping Emacs works only in batch mode"); |
| 2084 | 2091 | ||
| 2092 | if (!might_dump) | ||
| 2093 | error ("Emacs can be dumped only once"); | ||
| 2094 | |||
| 2085 | #ifdef GNU_LINUX | 2095 | #ifdef GNU_LINUX |
| 2086 | 2096 | ||
| 2087 | /* Warn if the gap between BSS end and heap start is larger than this. */ | 2097 | /* Warn if the gap between BSS end and heap start is larger than this. */ |
diff --git a/src/lisp.h b/src/lisp.h index 2f9a30fdfe9..df8f3120a8e 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -800,6 +800,7 @@ extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); | |||
| 800 | 800 | ||
| 801 | /* Defined in emacs.c. */ | 801 | /* Defined in emacs.c. */ |
| 802 | extern bool initialized; | 802 | extern bool initialized; |
| 803 | extern bool might_dump; | ||
| 803 | 804 | ||
| 804 | /* Defined in eval.c. */ | 805 | /* Defined in eval.c. */ |
| 805 | extern Lisp_Object Qautoload; | 806 | extern Lisp_Object Qautoload; |
diff --git a/src/unexcw.c b/src/unexcw.c index fcca5e5cbf2..25d13ca0ca4 100644 --- a/src/unexcw.c +++ b/src/unexcw.c | |||
| @@ -286,13 +286,6 @@ unexec (const char *outfile, const char *infile) | |||
| 286 | int ret; | 286 | int ret; |
| 287 | int ret2; | 287 | int ret2; |
| 288 | 288 | ||
| 289 | if (bss_sbrk_did_unexec) | ||
| 290 | { | ||
| 291 | /* can only dump once */ | ||
| 292 | printf ("You can only dump Emacs once on this platform.\n"); | ||
| 293 | return; | ||
| 294 | } | ||
| 295 | |||
| 296 | report_sheap_usage (1); | 289 | report_sheap_usage (1); |
| 297 | 290 | ||
| 298 | infile = add_exe_suffix_if_necessary (infile, infile_buffer); | 291 | infile = add_exe_suffix_if_necessary (infile, infile_buffer); |