Changes in uspace/lib/c/generic/rtld/module.c [a0e2f9c:1567471] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/rtld/module.c
ra0e2f9c r1567471 65 65 66 66 module = calloc(1, sizeof(module_t)); 67 if (module == NULL) { 68 DPRINTF("malloc failed\n"); 67 if (module == NULL) 69 68 return ENOMEM; 70 }71 69 72 70 module->id = rtld_get_next_id(rtld); … … 184 182 char name_buf[NAME_BUF_SIZE]; 185 183 module_t *m; 186 errno_t rc;184 int rc; 187 185 188 186 m = calloc(1, sizeof(module_t)); 189 187 if (m == NULL) { 190 DPRINTF("malloc failed\n");191 goto error;188 printf("malloc failed\n"); 189 exit(1); 192 190 } 193 191 … … 199 197 200 198 if (str_size(name) > NAME_BUF_SIZE - 2) { 201 DPRINTF("soname too long. increase NAME_BUF_SIZE\n");202 goto error;199 printf("soname too long. increase NAME_BUF_SIZE\n"); 200 exit(1); 203 201 } 204 202 … … 210 208 211 209 rc = elf_load_file_name(name_buf, RTLD_MODULE_LDF, &info); 212 if (rc != E OK) {213 DPRINTF("Failed to load '%s'\n", name_buf);214 goto error;210 if (rc != EE_OK) { 211 printf("Failed to load '%s'\n", name_buf); 212 exit(1); 215 213 } 216 214 … … 220 218 221 219 if (info.dynamic == NULL) { 222 DPRINTF("Error: '%s' is not a dynamically-linked object.\n",220 printf("Error: '%s' is not a dynamically-linked object.\n", 223 221 name_buf); 224 goto error;222 exit(1); 225 223 } 226 224 … … 245 243 246 244 return m; 247 248 error:249 if (m)250 free(m);251 252 return NULL;253 245 } 254 246 255 247 /** Load all modules on which m (transitively) depends. 256 248 */ 257 errno_tmodule_load_deps(module_t *m, mlflags_t flags)249 void module_load_deps(module_t *m, mlflags_t flags) 258 250 { 259 251 elf_dyn_t *dp; … … 282 274 /* There are no dependencies, so we are done. */ 283 275 m->deps = NULL; 284 return EOK;276 return; 285 277 } 286 278 287 279 m->deps = malloc(n * sizeof(module_t *)); 288 280 if (!m->deps) { 289 DPRINTF("malloc failed\n");290 return ENOMEM;281 printf("malloc failed\n"); 282 exit(1); 291 283 } 292 284 … … 302 294 if (!dm) { 303 295 dm = module_load(m->rtld, dep_name, flags); 304 if (!dm) { 305 return EINVAL; 306 } 307 308 errno_t rc = module_load_deps(dm, flags); 309 if (rc != EOK) { 310 return rc; 311 } 296 module_load_deps(dm, flags); 312 297 } 313 298 … … 317 302 ++dp; 318 303 } 319 320 return EOK;321 304 } 322 305
Note:
See TracChangeset
for help on using the changeset viewer.