[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] pdumper aacc139: Improve error message when attempting to
From: |
Daniel Colascione |
Subject: |
[Emacs-diffs] pdumper aacc139: Improve error message when attempting to load failed dump file |
Date: |
Mon, 26 Feb 2018 01:23:03 -0500 (EST) |
branch: pdumper
commit aacc1390f21ddb003c9d6a786597e89284bafec3
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>
Improve error message when attempting to load failed dump file
---
src/emacs.c | 2 ++
src/pdumper.c | 13 +++++++++++--
src/pdumper.h | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/emacs.c b/src/emacs.c
index 4159810..0ed3f90 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -714,6 +714,8 @@ dump_error_to_string (enum pdumper_load_result result)
return "could not open file";
case PDUMPER_LOAD_BAD_FILE_TYPE:
return "not a dump file";
+ case PDUMPER_LOAD_FAILED_DUMP:
+ return "dump file is result of failed dump attempt";
case PDUMPER_LOAD_VERSION_MISMATCH:
return "not built for this Emacs executable";
default:
diff --git a/src/pdumper.c b/src/pdumper.c
index 80ed9a8..4001772 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -5145,9 +5145,18 @@ pdumper_load (const char *dump_filename)
sizeof (*header)) < sizeof (*header))
goto out;
- err = PDUMPER_LOAD_BAD_FILE_TYPE;
if (memcmp (header->magic, dump_magic, sizeof (dump_magic)) != 0)
- goto out;
+ {
+ if (header->magic[0] == '!' &&
+ ((header->magic[0] = dump_magic[0]),
+ memcmp (header->magic, dump_magic, sizeof (dump_magic)) == 0))
+ {
+ err = PDUMPER_LOAD_FAILED_DUMP;
+ goto out;
+ }
+ err = PDUMPER_LOAD_BAD_FILE_TYPE;
+ goto out;
+ }
err = PDUMPER_LOAD_VERSION_MISMATCH;
verify (sizeof (header->fingerprint) == sizeof (fingerprint));
diff --git a/src/pdumper.h b/src/pdumper.h
index c407619..48d34dc 100644
--- a/src/pdumper.h
+++ b/src/pdumper.h
@@ -125,6 +125,7 @@ enum pdumper_load_result
PDUMPER_NOT_LOADED /* Not returned: useful for callers */,
PDUMPER_LOAD_FILE_NOT_FOUND,
PDUMPER_LOAD_BAD_FILE_TYPE,
+ PDUMPER_LOAD_FAILED_DUMP,
PDUMPER_LOAD_OOM,
PDUMPER_LOAD_VERSION_MISMATCH,
PDUMPER_LOAD_ERROR,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] pdumper aacc139: Improve error message when attempting to load failed dump file,
Daniel Colascione <=