# HG changeset patch # User Richard M. Stallman # Date 771810341 0 # Node ID 359834d749db7ce910f44c664ba7cd6f93ef3925 # Parent d7d962844f5fcf7c57e239ab89b0118789f29616 (make_hdr): Handle case of no "additional header". diff -r d7d962844f5f -r 359834d749db src/unexec.c --- a/src/unexec.c Thu Jun 16 23:33:50 1994 +0000 +++ b/src/unexec.c Thu Jun 16 23:45:41 1994 +0000 @@ -490,6 +490,7 @@ 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 @@ * 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--) {