comparison src/unexec.c @ 7931:359834d749db

(make_hdr): Handle case of no "additional header".
author Richard M. Stallman <rms@gnu.org>
date Thu, 16 Jun 1994 23:45:41 +0000
parents b3a5b629fe26
children de17ae9463e3
comparison
equal deleted inserted replaced
7930:d7d962844f5f 7931:359834d749db
488 PERROR (a_name); 488 PERROR (a_name);
489 } 489 }
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 {
496 PERROR (a_name); 497 PERROR (a_name);
497 } 498 }
655 * 656 *
656 * If any section precedes .text or .data in the file, this code 657 * If any section precedes .text or .data in the file, this code
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 {
664 if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp)) 667 if (read (a_out, &scntemp, sizeof (scntemp)) != sizeof (scntemp))
665 PERROR (a_name); 668 PERROR (a_name);