comparison src/unexelfsgi.c @ 448:3078fd1074e8 r21-2-39

Import from CVS: tag r21-2-39
author cvs
date Mon, 13 Aug 2007 11:38:25 +0200
parents 1ccc32a20af4
children 023b83f4e54b
comparison
equal deleted inserted replaced
447:4fc5f13f3bd3 448:3078fd1074e8
224 224
225 if (fstat (old_file, &stat_buf) == -1) 225 if (fstat (old_file, &stat_buf) == -1)
226 fatal ("Can't fstat (%s): errno %d\n", old_name, errno); 226 fatal ("Can't fstat (%s): errno %d\n", old_name, errno);
227 227
228 /* map old file into the address space. */ 228 /* map old file into the address space. */
229 if ( (old_base = (caddr_t) mmap ((caddr_t) 0, stat_buf.st_size, 229 old_base = (caddr_t) mmap ((caddr_t) 0, stat_buf.st_size,
230 PROT_READ, MAP_SHARED, old_file, 0)) < 0 ) 230 PROT_READ, MAP_SHARED, old_file, 0);
231 fatal ("Can't mmap (%s): errno %d\n", old_name, errno); 231 if (old_base == (caddr_t) MAP_FAILED)
232 fatal ("Can't mmap (%s): errno %d\n", old_name, errno);
232 233
233 old_file_h = (ElfW(Ehdr) *) old_base; 234 old_file_h = (ElfW(Ehdr) *) old_base;
234 old_program_h = (ElfW(Phdr) *) ((byte *) old_base + old_file_h->e_phoff); 235 old_program_h = (ElfW(Phdr) *) ((byte *) old_base + old_file_h->e_phoff);
235 old_section_h = (ElfW(Shdr) *) ((byte *) old_base + old_file_h->e_shoff); 236 old_section_h = (ElfW(Shdr) *) ((byte *) old_base + old_file_h->e_shoff);
236 old_section_names = (const char *) old_base 237 old_section_names = (const char *) old_base