aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2019-09-11 11:26:07 -0700
committerPaul Eggert2019-09-11 11:27:14 -0700
commit5fafa40d076ee24baf880e97d4290b6196cf838a (patch)
tree03452b023e9777409d979932b53f9ef347601b76 /src/alloc.c
parenta6daae7b3df3a964b3dcde85987c02fd0af66a89 (diff)
downloademacs-5fafa40d076ee24baf880e97d4290b6196cf838a.tar.gz
emacs-5fafa40d076ee24baf880e97d4290b6196cf838a.zip
Improve checking of pdump load failures
* src/alloc.c (memory_full): Just report "memory exhausted" if failure occurs during initialization, since fancier recovery schemes are not likely to work when not initialized. * src/emacs.c (dump_error_to_string): Accept int, not enum pdumper_load_result, since the result might not fit in the enum. Use strerror if it was derived from errno. This is for better diagnostics of pdump load failures. (load_pdump_find_executable): Return char *, not enum. 2nd arg is now pointer to buffer size, rather than pointer to pointer to buffer. All callers changed. Use Emacs allocator since they should now be OK even during early startup. Use check_executable instead access, to use effective rather than real permissions. (load_pdump): Return void since callers ignore result. Use int where enum could be too narrow. Use heap rather than stack for possibly-long string. Prefer ptrdiff_t to size_t. * src/fileio.c (check_executable): Now extern. * src/pdumper.c (pdumper_load): Return int that may have errno added to it, for better diagnostics when loads fail.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index be98cfd5f53..2d490f3bb75 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3844,6 +3844,9 @@ set_interval_marked (INTERVAL i)
3844void 3844void
3845memory_full (size_t nbytes) 3845memory_full (size_t nbytes)
3846{ 3846{
3847 if (!initialized)
3848 fatal ("memory exhausted");
3849
3847 /* Do not go into hysterics merely because a large request failed. */ 3850 /* Do not go into hysterics merely because a large request failed. */
3848 bool enough_free_memory = false; 3851 bool enough_free_memory = false;
3849 if (SPARE_MEMORY < nbytes) 3852 if (SPARE_MEMORY < nbytes)