Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/elf/elf_mod.c

    ra53ed3a r8e3498b  
    6969        "incompatible image",
    7070        "unsupported image type",
    71         "irrecoverable error",
    72         "file io error"
     71        "irrecoverable error"
    7372};
    7473
     
    9190 *                  extracted from the binary.
    9291 *
    93  * @return EE_OK on success or EE_xx error code.
     92 * @return EOK on success or negative error code.
    9493 *
    9594 */
     
    9897        elf_ld_t elf;
    9998
    100         int ofile;
    101         errno_t rc = vfs_clone(file, -1, true, &ofile);
    102         if (rc == EOK) {
    103                 rc = vfs_open(ofile, MODE_READ);
    104         }
     99        int ofile = vfs_clone(file, -1, true);
     100        int rc = vfs_open(ofile, MODE_READ);
    105101        if (rc != EOK) {
    106                 return EE_IO;
     102                return rc;
    107103        }
    108104
     
    111107        elf.flags = flags;
    112108
    113         int ret = elf_load_module(&elf, so_bias);
     109        rc = elf_load_module(&elf, so_bias);
    114110
    115111        vfs_put(ofile);
    116         return ret;
     112        return rc;
    117113}
    118114
     
    120116    elf_finfo_t *info)
    121117{
    122         int file;
    123         errno_t rc = vfs_lookup(path, 0, &file);
    124         if (rc == EOK) {
    125                 int ret = elf_load_file(file, so_bias, flags, info);
    126                 vfs_put(file);
    127                 return ret;
    128         } else {
    129                 return EE_IO;
    130         }
     118        int file = vfs_lookup(path, 0);
     119        int rc = elf_load_file(file, so_bias, flags, info);
     120        vfs_put(file);
     121        return rc;
    131122}
    132123
     
    147138        aoff64_t pos = 0;
    148139        size_t nr;
    149         int i, ret;
    150         errno_t rc;
     140        int i, rc;
    151141
    152142        rc = vfs_read(elf->fd, &pos, header, sizeof(elf_header_t), &nr);
    153143        if (rc != EOK || nr != sizeof(elf_header_t)) {
    154144                DPRINTF("Read error.\n");
    155                 return EE_IO;
     145                return EE_INVALID;
    156146        }
    157147
     
    213203                if (rc != EOK || nr != sizeof(elf_segment_header_t)) {
    214204                        DPRINTF("Read error.\n");
    215                         return EE_IO;
     205                        return EE_INVALID;
    216206                }
    217207
    218                 ret = segment_header(elf, &segment_hdr);
    219                 if (ret != EE_OK)
    220                         return ret;
     208                rc = segment_header(elf, &segment_hdr);
     209                if (rc != EE_OK)
     210                        return rc;
    221211        }
    222212
     
    232222                if (rc != EOK || nr != sizeof(elf_section_header_t)) {
    233223                        DPRINTF("Read error.\n");
    234                         return EE_IO;
     224                        return EE_INVALID;
    235225                }
    236226
    237                 ret = section_header(elf, &section_hdr);
    238                 if (ret != EE_OK)
    239                         return ret;
     227                rc = section_header(elf, &section_hdr);
     228                if (rc != EE_OK)
     229                        return rc;
    240230        }
    241231
     
    341331        size_t mem_sz;
    342332        aoff64_t pos;
    343         errno_t rc;
     333        int rc;
    344334        size_t nr;
    345335
     
    403393        if (rc != EOK || nr != entry->p_filesz) {
    404394                DPRINTF("read error\n");
    405                 return EE_IO;
     395                return EE_INVALID;
    406396        }
    407397
     
    414404//      printf("set area flags to %d\n", flags);
    415405        rc = as_area_change_flags(seg_ptr, flags);
    416         if (rc != EOK) {
     406        if (rc != 0) {
    417407                DPRINTF("Failed to set memory area flags.\n");
    418408                return EE_MEMORY;
Note: See TracChangeset for help on using the changeset viewer.