- return file->ops->read_page(file->inode, pg, PG_SIZE, offset);
+ return file->ops->read_page(file->inode, pg, PG_SIZE, segfoff);
- return file->ops->read(file->inode, pg, rdlen, offset);
+ // we don't want to over-read the segment!
+ return file->ops->read(file->inode, pg, rdlen, segfoff);
- phdrs = elfile->ops->read(elfile->inode, phdrs, tbl_sz, ehdr->e_phoff);
+ status = elfile->ops->read(elfile->inode, phdrs, tbl_sz, ehdr->e_phoff);
+
+ if (status < 0) {
+ goto done;
+ }
struct elf32_ehdr* ehdr = valloc(SIZE_EHDR);
int status = elfile->ops->read(elfile->inode, ehdr, SIZE_EHDR, 0);
struct elf32_ehdr* ehdr = valloc(SIZE_EHDR);
int status = elfile->ops->read(elfile->inode, ehdr, SIZE_EHDR, 0);