summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2022-10-04 18:22:58 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2022-10-04 18:32:53 +0200
commita78af3018e30394137b07d94e3b763674a233afc (patch)
tree7c753fa9e0905c25fb8c30c11391255ba1134458
parentb560ce3560fc1559a08667798710cf37af0e079a (diff)
downloademacs-a78af3018e30394137b07d94e3b763674a233afc.tar.gz
* src/emacs.c (load_pdump): Propery handle case when executable
wasn't found.
-rw-r--r--src/emacs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 92779a8d0de..a8af288bf09 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -867,13 +867,17 @@ load_pdump (int argc, char **argv)
}
/* Where's our executable? */
- ptrdiff_t exec_bufsize, needed;
+ ptrdiff_t exec_bufsize, bufsize, needed;
emacs_executable = load_pdump_find_executable (argv[0], &exec_bufsize);
/* If we couldn't find our executable, go straight to looking for
the dump in the hardcoded location. */
if (!(emacs_executable && *emacs_executable))
- goto hardcoded;
+ {
+ bufsize = 0;
+ dump_file = NULL;
+ goto hardcoded;
+ }
if (dump_file)
{
@@ -901,7 +905,7 @@ load_pdump (int argc, char **argv)
strip_suffix_length))
exenamelen = prefix_length;
}
- ptrdiff_t bufsize = exenamelen + strlen (suffix) + 1;
+ bufsize = exenamelen + strlen (suffix) + 1;
dump_file = xpalloc (NULL, &bufsize, 1, -1, 1);
memcpy (dump_file, emacs_executable, exenamelen);
strcpy (dump_file + exenamelen, suffix);