aboutsummaryrefslogtreecommitdiffstats
path: root/src/unexec.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-06-16 23:45:41 +0000
committerRichard M. Stallman1994-06-16 23:45:41 +0000
commitdcceb381ab25d112997e5e4bdd10993dfe5f42ea (patch)
tree01ff06cd555034db8426e3437471bd9afb3b7bee /src/unexec.c
parentebfbbbe463c0984204346c80737c95ce20dbaad3 (diff)
downloademacs-dcceb381ab25d112997e5e4bdd10993dfe5f42ea.tar.gz
emacs-dcceb381ab25d112997e5e4bdd10993dfe5f42ea.zip
(make_hdr): Handle case of no "additional header".
Diffstat (limited to 'src/unexec.c')
-rw-r--r--src/unexec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unexec.c b/src/unexec.c
index d91644519f1..2de8b20b588 100644
--- a/src/unexec.c
+++ b/src/unexec.c
@@ -490,6 +490,7 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
490 block_copy_start += sizeof (f_ohdr); 490 block_copy_start += sizeof (f_ohdr);
491 } 491 }
492 /* Loop through section headers, copying them in */ 492 /* Loop through section headers, copying them in */
493 lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
493 for (scns = f_hdr.f_nscns; scns > 0; scns--) { 494 for (scns = f_hdr.f_nscns; scns > 0; scns--) {
494 if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp)) 495 if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp))
495 { 496 {
@@ -657,7 +658,9 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
657 * will not adjust the file pointer for that section correctly. 658 * will not adjust the file pointer for that section correctly.
658 */ 659 */
659 660
660 lseek (a_out, sizeof (f_hdr) + sizeof (f_ohdr), 0); 661 /* This used to use sizeof (f_ohdr) instead of .f_opthdr.
662 .f_opthdr is said to be right when there is no optional header. */
663 lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
661 664
662 for (scns = f_hdr.f_nscns; scns > 0; scns--) 665 for (scns = f_hdr.f_nscns; scns > 0; scns--)
663 { 666 {