Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskdump/elf_core.c

    r125c09c r8d2dd7f2  
    5555#include <stddef.h>
    5656#include <errno.h>
    57 #include <str_error.h>
    5857#include <mem.h>
    5958#include <as.h>
     
    9897
    9998        int fd;
    100         int rc;
    101         size_t nwr;
     99        ssize_t rc;
    102100        unsigned int i;
    103101
     
    124122        }
    125123
    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");
    130128                free(p_hdr);
    131129                return ENOENT;
     
    208206        }
    209207
    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)) {
    212210                printf("Failed writing ELF header.\n");
    213211                free(p_hdr);
     
    216214
    217215        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])) {
    220218                        printf("Failed writing program header.\n");
    221219                        free(p_hdr);
     
    233231        note.type = NT_PRSTATUS;
    234232
    235         rc = vfs_write(fd, &pos, &note, sizeof(elf_note_t), &nwr);
    236         if (rc != EOK) {
     233        rc = vfs_write(fd, &pos, &note, sizeof(elf_note_t));
     234        if (rc != sizeof(elf_note_t)) {
    237235                printf("Failed writing note header.\n");
    238236                free(p_hdr);
     
    240238        }
    241239
    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) {
    244242                printf("Failed writing note header.\n");
    245243                free(p_hdr);
     
    249247        pos = ALIGN_UP(pos, word_size);
    250248
    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)) {
    253251                printf("Failed writing register data.\n");
    254252                free(p_hdr);
     
    298296        size_t total;
    299297        uintptr_t addr;
    300         int rc;
    301         size_t nwr;
     298        ssize_t rc;
    302299
    303300        addr = area->start_addr;
     
    312309                }
    313310
    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) {
    316313                        printf("Failed writing memory contents.\n");
    317314                        return EIO;
Note: See TracChangeset for help on using the changeset viewer.