Changes in uspace/lib/c/generic/elf/elf_mod.c [a53ed3a:8e3498b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/elf/elf_mod.c
ra53ed3a r8e3498b 69 69 "incompatible image", 70 70 "unsupported image type", 71 "irrecoverable error", 72 "file io error" 71 "irrecoverable error" 73 72 }; 74 73 … … 91 90 * extracted from the binary. 92 91 * 93 * @return E E_OK on success or EE_xxerror code.92 * @return EOK on success or negative error code. 94 93 * 95 94 */ … … 98 97 elf_ld_t elf; 99 98 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); 105 101 if (rc != EOK) { 106 return EE_IO;102 return rc; 107 103 } 108 104 … … 111 107 elf.flags = flags; 112 108 113 int ret= elf_load_module(&elf, so_bias);109 rc = elf_load_module(&elf, so_bias); 114 110 115 111 vfs_put(ofile); 116 return r et;112 return rc; 117 113 } 118 114 … … 120 116 elf_finfo_t *info) 121 117 { 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; 131 122 } 132 123 … … 147 138 aoff64_t pos = 0; 148 139 size_t nr; 149 int i, ret; 150 errno_t rc; 140 int i, rc; 151 141 152 142 rc = vfs_read(elf->fd, &pos, header, sizeof(elf_header_t), &nr); 153 143 if (rc != EOK || nr != sizeof(elf_header_t)) { 154 144 DPRINTF("Read error.\n"); 155 return EE_I O;145 return EE_INVALID; 156 146 } 157 147 … … 213 203 if (rc != EOK || nr != sizeof(elf_segment_header_t)) { 214 204 DPRINTF("Read error.\n"); 215 return EE_I O;205 return EE_INVALID; 216 206 } 217 207 218 r et= segment_header(elf, &segment_hdr);219 if (r et!= EE_OK)220 return r et;208 rc = segment_header(elf, &segment_hdr); 209 if (rc != EE_OK) 210 return rc; 221 211 } 222 212 … … 232 222 if (rc != EOK || nr != sizeof(elf_section_header_t)) { 233 223 DPRINTF("Read error.\n"); 234 return EE_I O;224 return EE_INVALID; 235 225 } 236 226 237 r et= section_header(elf, §ion_hdr);238 if (r et!= EE_OK)239 return r et;227 rc = section_header(elf, §ion_hdr); 228 if (rc != EE_OK) 229 return rc; 240 230 } 241 231 … … 341 331 size_t mem_sz; 342 332 aoff64_t pos; 343 errno_t rc;333 int rc; 344 334 size_t nr; 345 335 … … 403 393 if (rc != EOK || nr != entry->p_filesz) { 404 394 DPRINTF("read error\n"); 405 return EE_I O;395 return EE_INVALID; 406 396 } 407 397 … … 414 404 // printf("set area flags to %d\n", flags); 415 405 rc = as_area_change_flags(seg_ptr, flags); 416 if (rc != EOK) {406 if (rc != 0) { 417 407 DPRINTF("Failed to set memory area flags.\n"); 418 408 return EE_MEMORY;
Note:
See TracChangeset
for help on using the changeset viewer.