Changes in uspace/app/taskdump/symtab.c [8d2dd7f2:125c09c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/symtab.c
r8d2dd7f2 r125c09c 41 41 #include <stddef.h> 42 42 #include <errno.h> 43 #include <str_error.h> 43 44 #include <vfs/vfs.h> 44 45 … … 71 72 int fd; 72 73 int rc; 74 size_t nread; 73 75 int i; 74 76 … … 81 83 return ENOMEM; 82 84 83 fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);84 if ( fd < 0) {85 printf("failed opening file \n");85 rc = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ, &fd); 86 if (rc != EOK) { 87 printf("failed opening file '%s': %s\n", file_name, str_error(rc)); 86 88 free(stab); 87 89 return ENOENT; 88 90 } 89 91 90 rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t) );91 if (rc != sizeof(elf_header_t)) {92 rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t), &nread); 93 if (rc != EOK || nread != sizeof(elf_header_t)) { 92 94 printf("failed reading elf header\n"); 93 95 free(stab); … … 304 306 { 305 307 int rc; 308 size_t nread; 306 309 aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t); 307 310 308 rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t) );309 if (rc != sizeof(elf_section_header_t))311 rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t), &nread); 312 if (rc != EOK || nread != sizeof(elf_section_header_t)) 310 313 return EIO; 311 314 … … 326 329 static int chunk_load(int fd, off64_t start, size_t size, void **ptr) 327 330 { 328 ssize_t rc; 331 int rc; 332 size_t nread; 329 333 aoff64_t pos = start; 330 334 … … 335 339 } 336 340 337 rc = vfs_read(fd, &pos, *ptr, size );338 if (rc != (ssize_t)size) {341 rc = vfs_read(fd, &pos, *ptr, size, &nread); 342 if (rc != EOK || nread != size) { 339 343 printf("failed reading chunk\n"); 340 344 free(*ptr);
Note:
See TracChangeset
for help on using the changeset viewer.