X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/a6c4680aa241f3599a2d7cf93a977c338b52c062..1edb4a2ec657c305880901e78317daf1990b5358:/src/emacs.c diff --git a/src/emacs.c b/src/emacs.c index 18f6a089db..50efcbfb60 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -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 @@ -731,6 +734,10 @@ main (int argc, char **argv) xputenv ("G_SLICE=always-malloc"); #endif +#ifndef CANNOT_DUMP + might_dump = !initialized; +#endif + #ifdef GNU_LINUX if (!initialized) { @@ -1005,6 +1012,9 @@ main (int argc, char **argv) exit (0); } + /* Make sure IS_DAEMON starts up as false. */ + daemon_pipe[1] = 0; + if (argmatch (argv, argc, "-daemon", "--daemon", 5, NULL, &skip_args) || argmatch (argv, argc, "-daemon", "--daemon", 5, &dname_arg, &skip_args)) { @@ -2079,6 +2089,9 @@ You must run Emacs in batch mode in order to dump it. */) 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. */ @@ -2548,7 +2561,4 @@ libraries; only those already known by Emacs will be loaded. */); Vlibrary_cache = Qnil; staticpro (&Vlibrary_cache); #endif - - /* Make sure IS_DAEMON starts up as false. */ - daemon_pipe[1] = 0; }