Changes in uspace/app/taskdump/elf_core.c [125c09c:8d2dd7f2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/elf_core.c
r125c09c r8d2dd7f2 55 55 #include <stddef.h> 56 56 #include <errno.h> 57 #include <str_error.h>58 57 #include <mem.h> 59 58 #include <as.h> … … 98 97 99 98 int fd; 100 int rc; 101 size_t nwr; 99 ssize_t rc; 102 100 unsigned int i; 103 101 … … 124 122 } 125 123 126 rc= vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE,127 MODE_WRITE , &fd);128 if ( rc != EOK) {129 printf("Failed opening file '%s': %s.\n", file_name, str_error(rc));124 fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE, 125 MODE_WRITE); 126 if (fd < 0) { 127 printf("Failed opening file.\n"); 130 128 free(p_hdr); 131 129 return ENOENT; … … 208 206 } 209 207 210 rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr) , &nwr);211 if (rc != EOK) {208 rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr)); 209 if (rc != sizeof(elf_hdr)) { 212 210 printf("Failed writing ELF header.\n"); 213 211 free(p_hdr); … … 216 214 217 215 for (i = 0; i < n_ph; ++i) { 218 rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]) , &nwr);219 if (rc != EOK) {216 rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i])); 217 if (rc != sizeof(p_hdr[i])) { 220 218 printf("Failed writing program header.\n"); 221 219 free(p_hdr); … … 233 231 note.type = NT_PRSTATUS; 234 232 235 rc = vfs_write(fd, &pos, ¬e, sizeof(elf_note_t) , &nwr);236 if (rc != EOK) {233 rc = vfs_write(fd, &pos, ¬e, sizeof(elf_note_t)); 234 if (rc != sizeof(elf_note_t)) { 237 235 printf("Failed writing note header.\n"); 238 236 free(p_hdr); … … 240 238 } 241 239 242 rc = vfs_write(fd, &pos, "CORE", note.namesz , &nwr);243 if (rc != EOK) {240 rc = vfs_write(fd, &pos, "CORE", note.namesz); 241 if (rc != (ssize_t) note.namesz) { 244 242 printf("Failed writing note header.\n"); 245 243 free(p_hdr); … … 249 247 pos = ALIGN_UP(pos, word_size); 250 248 251 rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t) , &nwr);252 if (rc != EOK) {249 rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t)); 250 if (rc != sizeof(elf_prstatus_t)) { 253 251 printf("Failed writing register data.\n"); 254 252 free(p_hdr); … … 298 296 size_t total; 299 297 uintptr_t addr; 300 int rc; 301 size_t nwr; 298 ssize_t rc; 302 299 303 300 addr = area->start_addr; … … 312 309 } 313 310 314 rc = vfs_write(fd, pos, buffer, to_copy , &nwr);315 if (rc != EOK) {311 rc = vfs_write(fd, pos, buffer, to_copy); 312 if (rc != (ssize_t) to_copy) { 316 313 printf("Failed writing memory contents.\n"); 317 314 return EIO;
Note:
See TracChangeset
for help on using the changeset viewer.