Changeset 8e3498b in mainline for uspace/app/taskdump
- Timestamp:
- 2017-12-04T18:44:24Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bde5c04
- Parents:
- 40feeac
- Location:
- uspace/app/taskdump
- Files:
-
- 2 edited
-
elf_core.c (modified) (8 diffs)
-
symtab.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/elf_core.c
r40feeac r8e3498b 97 97 98 98 int fd; 99 ssize_t rc; 99 int rc; 100 size_t nwr; 100 101 unsigned int i; 101 102 … … 206 207 } 207 208 208 rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr) );209 if (rc != sizeof(elf_hdr)) {209 rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr), &nwr); 210 if (rc != EOK) { 210 211 printf("Failed writing ELF header.\n"); 211 212 free(p_hdr); … … 214 215 215 216 for (i = 0; i < n_ph; ++i) { 216 rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]) );217 if (rc != sizeof(p_hdr[i])) {217 rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]), &nwr); 218 if (rc != EOK) { 218 219 printf("Failed writing program header.\n"); 219 220 free(p_hdr); … … 231 232 note.type = NT_PRSTATUS; 232 233 233 rc = vfs_write(fd, &pos, ¬e, sizeof(elf_note_t) );234 if (rc != sizeof(elf_note_t)) {234 rc = vfs_write(fd, &pos, ¬e, sizeof(elf_note_t), &nwr); 235 if (rc != EOK) { 235 236 printf("Failed writing note header.\n"); 236 237 free(p_hdr); … … 238 239 } 239 240 240 rc = vfs_write(fd, &pos, "CORE", note.namesz );241 if (rc != (ssize_t) note.namesz) {241 rc = vfs_write(fd, &pos, "CORE", note.namesz, &nwr); 242 if (rc != EOK) { 242 243 printf("Failed writing note header.\n"); 243 244 free(p_hdr); … … 247 248 pos = ALIGN_UP(pos, word_size); 248 249 249 rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t) );250 if (rc != sizeof(elf_prstatus_t)) {250 rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t), &nwr); 251 if (rc != EOK) { 251 252 printf("Failed writing register data.\n"); 252 253 free(p_hdr); … … 296 297 size_t total; 297 298 uintptr_t addr; 298 ssize_t rc; 299 int rc; 300 size_t nwr; 299 301 300 302 addr = area->start_addr; … … 309 311 } 310 312 311 rc = vfs_write(fd, pos, buffer, to_copy );312 if (rc != (ssize_t) to_copy) {313 rc = vfs_write(fd, pos, buffer, to_copy, &nwr); 314 if (rc != EOK) { 313 315 printf("Failed writing memory contents.\n"); 314 316 return EIO; -
uspace/app/taskdump/symtab.c
r40feeac r8e3498b 71 71 int fd; 72 72 int rc; 73 size_t nread; 73 74 int i; 74 75 … … 88 89 } 89 90 90 rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t) );91 if (rc != sizeof(elf_header_t)) {91 rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t), &nread); 92 if (rc != EOK || nread != sizeof(elf_header_t)) { 92 93 printf("failed reading elf header\n"); 93 94 free(stab); … … 304 305 { 305 306 int rc; 307 size_t nread; 306 308 aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t); 307 309 308 rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t) );309 if (rc != sizeof(elf_section_header_t))310 rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t), &nread); 311 if (rc != EOK || nread != sizeof(elf_section_header_t)) 310 312 return EIO; 311 313 … … 326 328 static int chunk_load(int fd, off64_t start, size_t size, void **ptr) 327 329 { 328 ssize_t rc; 330 int rc; 331 size_t nread; 329 332 aoff64_t pos = start; 330 333 … … 335 338 } 336 339 337 rc = vfs_read(fd, &pos, *ptr, size );338 if (rc != (ssize_t)size) {340 rc = vfs_read(fd, &pos, *ptr, size, &nread); 341 if (rc != EOK || nread != size) { 339 342 printf("failed reading chunk\n"); 340 343 free(*ptr);
Note:
See TracChangeset
for help on using the changeset viewer.
