]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve error message when attempting to load failed dump file
authorDaniel Colascione <dancol@dancol.org>
Mon, 26 Feb 2018 06:22:40 +0000 (22:22 -0800)
committerDaniel Colascione <dancol@dancol.org>
Mon, 26 Feb 2018 06:22:40 +0000 (22:22 -0800)
src/emacs.c
src/pdumper.c
src/pdumper.h

index 415981096c3424005a2825b1f63714303f24d3b0..0ed3f905bbef3724695fa869bb6b3ad866d196dc 100644 (file)
@@ -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:
index 80ed9a8183fe1587c856c421b7ce92f012e63310..400177223a4b905d7d2c4c944194256378265cd3 100644 (file)
@@ -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));
index c40761944d88f4c5a82801d65d5be84f89ce4ff0..48d34dc0bf12473629bc33aa84d19b54b37a5f00 100644 (file)
@@ -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,