aboutsummaryrefslogtreecommitdiffstats
path: root/src/unexec.c
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1994-06-16 23:45:41 +0000
committerRichard M. Stallman <[email protected]>1994-06-16 23:45:41 +0000
commitdcceb381ab25d112997e5e4bdd10993dfe5f42ea (patch)
tree01ff06cd555034db8426e3437471bd9afb3b7bee /src/unexec.c
parentebfbbbe463c0984204346c80737c95ce20dbaad3 (diff)
(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 d91644519f..2de8b20b58 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)
block_copy_start += sizeof (f_ohdr);
}
/* Loop through section headers, copying them in */
+ lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
for (scns = f_hdr.f_nscns; scns > 0; scns--) {
if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp))
{
@@ -657,7 +658,9 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
* will not adjust the file pointer for that section correctly.
*/
- lseek (a_out, sizeof (f_hdr) + sizeof (f_ohdr), 0);
+ /* This used to use sizeof (f_ohdr) instead of .f_opthdr.
+ .f_opthdr is said to be right when there is no optional header. */
+ lseek (a_out, sizeof (f_hdr) + f_hdr.f_opthdr, 0);
for (scns = f_hdr.f_nscns; scns > 0; scns--)
{