diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /modutils | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/insmod.c | 126 | ||||
-rw-r--r-- | modutils/lsmod.c | 11 | ||||
-rw-r--r-- | modutils/modprobe.c | 36 | ||||
-rw-r--r-- | modutils/rmmod.c | 10 |
4 files changed, 92 insertions, 91 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 56e78e833..b45357a69 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -247,7 +247,7 @@ | |||
247 | #ifndef MODUTILS_MODULE_H | 247 | #ifndef MODUTILS_MODULE_H |
248 | static const int MODUTILS_MODULE_H = 1; | 248 | static const int MODUTILS_MODULE_H = 1; |
249 | 249 | ||
250 | #ident "$Id: insmod.c,v 1.96 2003/03/13 18:57:08 andersen Exp $" | 250 | #ident "$Id: insmod.c,v 1.97 2003/03/19 09:12:33 mjn3 Exp $" |
251 | 251 | ||
252 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 252 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
253 | We do not use the kernel headers directly because we do not wish | 253 | We do not use the kernel headers directly because we do not wish |
@@ -468,7 +468,7 @@ int delete_module(const char *); | |||
468 | #ifndef MODUTILS_OBJ_H | 468 | #ifndef MODUTILS_OBJ_H |
469 | static const int MODUTILS_OBJ_H = 1; | 469 | static const int MODUTILS_OBJ_H = 1; |
470 | 470 | ||
471 | #ident "$Id: insmod.c,v 1.96 2003/03/13 18:57:08 andersen Exp $" | 471 | #ident "$Id: insmod.c,v 1.97 2003/03/19 09:12:33 mjn3 Exp $" |
472 | 472 | ||
473 | /* The relocatable object is manipulated using elfin types. */ | 473 | /* The relocatable object is manipulated using elfin types. */ |
474 | 474 | ||
@@ -769,12 +769,12 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, | |||
769 | if (fullname[0] == '\0') | 769 | if (fullname[0] == '\0') |
770 | return (FALSE); | 770 | return (FALSE); |
771 | else { | 771 | else { |
772 | char *tmp, *tmp1 = xstrdup(filename); | 772 | char *tmp, *tmp1 = bb_xstrdup(filename); |
773 | tmp = get_last_path_component(tmp1); | 773 | tmp = bb_get_last_path_component(tmp1); |
774 | if (strcmp(tmp, fullname) == 0) { | 774 | if (strcmp(tmp, fullname) == 0) { |
775 | free(tmp1); | 775 | free(tmp1); |
776 | /* Stop searching if we find a match */ | 776 | /* Stop searching if we find a match */ |
777 | m_filename = xstrdup(filename); | 777 | m_filename = bb_xstrdup(filename); |
778 | return (TRUE); | 778 | return (TRUE); |
779 | } | 779 | } |
780 | free(tmp1); | 780 | free(tmp1); |
@@ -1700,7 +1700,7 @@ obj_add_symbol(struct obj_file *f, const char *name, | |||
1700 | /* Don't report an error if the symbol is coming from | 1700 | /* Don't report an error if the symbol is coming from |
1701 | the kernel or some external module. */ | 1701 | the kernel or some external module. */ |
1702 | if (secidx <= SHN_HIRESERVE) | 1702 | if (secidx <= SHN_HIRESERVE) |
1703 | error_msg("%s multiply defined", name); | 1703 | bb_error_msg("%s multiply defined", name); |
1704 | return sym; | 1704 | return sym; |
1705 | } | 1705 | } |
1706 | } | 1706 | } |
@@ -1713,7 +1713,7 @@ obj_add_symbol(struct obj_file *f, const char *name, | |||
1713 | 1713 | ||
1714 | if (ELFW(ST_BIND)(info) == STB_LOCAL && symidx != -1) { | 1714 | if (ELFW(ST_BIND)(info) == STB_LOCAL && symidx != -1) { |
1715 | if (symidx >= f->local_symtab_size) | 1715 | if (symidx >= f->local_symtab_size) |
1716 | error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld", | 1716 | bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld", |
1717 | name, (long) symidx, (long) f->local_symtab_size); | 1717 | name, (long) symidx, (long) f->local_symtab_size); |
1718 | else | 1718 | else |
1719 | f->local_symtab[symidx] = sym; | 1719 | f->local_symtab[symidx] = sym; |
@@ -1996,7 +1996,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1996 | 1996 | ||
1997 | /* Also check that the parameter was not resolved from the kernel. */ | 1997 | /* Also check that the parameter was not resolved from the kernel. */ |
1998 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1998 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1999 | error_msg("symbol for parameter %s not found", p); | 1999 | bb_error_msg("symbol for parameter %s not found", p); |
2000 | return 0; | 2000 | return 0; |
2001 | } | 2001 | } |
2002 | 2002 | ||
@@ -2009,7 +2009,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2009 | str = alloca(strlen(q)); | 2009 | str = alloca(strlen(q)); |
2010 | for (r = str, q++; *q != '"'; ++q, ++r) { | 2010 | for (r = str, q++; *q != '"'; ++q, ++r) { |
2011 | if (*q == '\0') { | 2011 | if (*q == '\0') { |
2012 | error_msg("improperly terminated string argument for %s", p); | 2012 | bb_error_msg("improperly terminated string argument for %s", p); |
2013 | return 0; | 2013 | return 0; |
2014 | } else if (*q == '\\') | 2014 | } else if (*q == '\\') |
2015 | switch (*++q) { | 2015 | switch (*++q) { |
@@ -2139,9 +2139,9 @@ static int old_get_kernel_symbols(const char *m_name) | |||
2139 | nks = get_kernel_syms(NULL); | 2139 | nks = get_kernel_syms(NULL); |
2140 | if (nks <= 0) { | 2140 | if (nks <= 0) { |
2141 | if (nks) | 2141 | if (nks) |
2142 | perror_msg("get_kernel_syms: %s", m_name); | 2142 | bb_perror_msg("get_kernel_syms: %s", m_name); |
2143 | else | 2143 | else |
2144 | error_msg("No kernel symbols"); | 2144 | bb_error_msg("No kernel symbols"); |
2145 | return 0; | 2145 | return 0; |
2146 | } | 2146 | } |
2147 | 2147 | ||
@@ -2322,7 +2322,7 @@ old_init_module(const char *m_name, struct obj_file *f, | |||
2322 | m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN | 2322 | m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN |
2323 | : 0), &routines, symtab); | 2323 | : 0), &routines, symtab); |
2324 | if (ret) | 2324 | if (ret) |
2325 | perror_msg("init_module: %s", m_name); | 2325 | bb_perror_msg("init_module: %s", m_name); |
2326 | 2326 | ||
2327 | free(image); | 2327 | free(image); |
2328 | free(symtab); | 2328 | free(symtab); |
@@ -2365,7 +2365,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2365 | p = get_modinfo_value(f, key); | 2365 | p = get_modinfo_value(f, key); |
2366 | key += 5; | 2366 | key += 5; |
2367 | if (p == NULL) { | 2367 | if (p == NULL) { |
2368 | error_msg("invalid parameter %s", key); | 2368 | bb_error_msg("invalid parameter %s", key); |
2369 | return 0; | 2369 | return 0; |
2370 | } | 2370 | } |
2371 | 2371 | ||
@@ -2380,7 +2380,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2380 | 2380 | ||
2381 | /* Also check that the parameter was not resolved from the kernel. */ | 2381 | /* Also check that the parameter was not resolved from the kernel. */ |
2382 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 2382 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
2383 | error_msg("symbol for parameter %s not found", key); | 2383 | bb_error_msg("symbol for parameter %s not found", key); |
2384 | return 0; | 2384 | return 0; |
2385 | } | 2385 | } |
2386 | 2386 | ||
@@ -2408,7 +2408,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2408 | str = alloca(strlen(q)); | 2408 | str = alloca(strlen(q)); |
2409 | for (r = str, q++; *q != '"'; ++q, ++r) { | 2409 | for (r = str, q++; *q != '"'; ++q, ++r) { |
2410 | if (*q == '\0') { | 2410 | if (*q == '\0') { |
2411 | error_msg("improperly terminated string argument for %s", | 2411 | bb_error_msg("improperly terminated string argument for %s", |
2412 | key); | 2412 | key); |
2413 | return 0; | 2413 | return 0; |
2414 | } else if (*q == '\\') | 2414 | } else if (*q == '\\') |
@@ -2502,7 +2502,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2502 | /* Get the size of each member */ | 2502 | /* Get the size of each member */ |
2503 | /* Probably we should do that outside the loop ? */ | 2503 | /* Probably we should do that outside the loop ? */ |
2504 | if (!isdigit(*(p + 1))) { | 2504 | if (!isdigit(*(p + 1))) { |
2505 | error_msg("parameter type 'c' for %s must be followed by" | 2505 | bb_error_msg("parameter type 'c' for %s must be followed by" |
2506 | " the maximum size", key); | 2506 | " the maximum size", key); |
2507 | return 0; | 2507 | return 0; |
2508 | } | 2508 | } |
@@ -2510,7 +2510,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2510 | 2510 | ||
2511 | /* Check length */ | 2511 | /* Check length */ |
2512 | if (strlen(str) >= charssize) { | 2512 | if (strlen(str) >= charssize) { |
2513 | error_msg("string too long for %s (max %ld)", key, | 2513 | bb_error_msg("string too long for %s (max %ld)", key, |
2514 | charssize - 1); | 2514 | charssize - 1); |
2515 | return 0; | 2515 | return 0; |
2516 | } | 2516 | } |
@@ -2539,7 +2539,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2539 | break; | 2539 | break; |
2540 | 2540 | ||
2541 | default: | 2541 | default: |
2542 | error_msg("unknown parameter type '%c' for %s", *p, key); | 2542 | bb_error_msg("unknown parameter type '%c' for %s", *p, key); |
2543 | return 0; | 2543 | return 0; |
2544 | } | 2544 | } |
2545 | } | 2545 | } |
@@ -2558,21 +2558,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
2558 | 2558 | ||
2559 | case ',': | 2559 | case ',': |
2560 | if (++n > max) { | 2560 | if (++n > max) { |
2561 | error_msg("too many values for %s (max %d)", key, max); | 2561 | bb_error_msg("too many values for %s (max %d)", key, max); |
2562 | return 0; | 2562 | return 0; |
2563 | } | 2563 | } |
2564 | ++q; | 2564 | ++q; |
2565 | break; | 2565 | break; |
2566 | 2566 | ||
2567 | default: | 2567 | default: |
2568 | error_msg("invalid argument syntax for %s", key); | 2568 | bb_error_msg("invalid argument syntax for %s", key); |
2569 | return 0; | 2569 | return 0; |
2570 | } | 2570 | } |
2571 | } | 2571 | } |
2572 | 2572 | ||
2573 | end_of_arg: | 2573 | end_of_arg: |
2574 | if (n < min) { | 2574 | if (n < min) { |
2575 | error_msg("too few values for %s (min %d)", key, min); | 2575 | bb_error_msg("too few values for %s (min %d)", key, min); |
2576 | return 0; | 2576 | return 0; |
2577 | } | 2577 | } |
2578 | 2578 | ||
@@ -2641,7 +2641,7 @@ static int new_get_kernel_symbols(void) | |||
2641 | module_names = xrealloc(module_names, bufsize = ret); | 2641 | module_names = xrealloc(module_names, bufsize = ret); |
2642 | goto retry_modules_load; | 2642 | goto retry_modules_load; |
2643 | } | 2643 | } |
2644 | perror_msg("QM_MODULES"); | 2644 | bb_perror_msg("QM_MODULES"); |
2645 | return 0; | 2645 | return 0; |
2646 | } | 2646 | } |
2647 | 2647 | ||
@@ -2661,7 +2661,7 @@ static int new_get_kernel_symbols(void) | |||
2661 | /* The module was removed out from underneath us. */ | 2661 | /* The module was removed out from underneath us. */ |
2662 | continue; | 2662 | continue; |
2663 | } | 2663 | } |
2664 | perror_msg("query_module: QM_INFO: %s", mn); | 2664 | bb_perror_msg("query_module: QM_INFO: %s", mn); |
2665 | return 0; | 2665 | return 0; |
2666 | } | 2666 | } |
2667 | 2667 | ||
@@ -2676,7 +2676,7 @@ static int new_get_kernel_symbols(void) | |||
2676 | /* The module was removed out from underneath us. */ | 2676 | /* The module was removed out from underneath us. */ |
2677 | continue; | 2677 | continue; |
2678 | default: | 2678 | default: |
2679 | perror_msg("query_module: QM_SYMBOLS: %s", mn); | 2679 | bb_perror_msg("query_module: QM_SYMBOLS: %s", mn); |
2680 | return 0; | 2680 | return 0; |
2681 | } | 2681 | } |
2682 | } | 2682 | } |
@@ -2702,7 +2702,7 @@ static int new_get_kernel_symbols(void) | |||
2702 | syms = xrealloc(syms, bufsize = ret); | 2702 | syms = xrealloc(syms, bufsize = ret); |
2703 | goto retry_kern_sym_load; | 2703 | goto retry_kern_sym_load; |
2704 | } | 2704 | } |
2705 | perror_msg("kernel: QM_SYMBOLS"); | 2705 | bb_perror_msg("kernel: QM_SYMBOLS"); |
2706 | return 0; | 2706 | return 0; |
2707 | } | 2707 | } |
2708 | nksyms = nsyms = ret; | 2708 | nksyms = nsyms = ret; |
@@ -2863,7 +2863,7 @@ new_init_module(const char *m_name, struct obj_file *f, | |||
2863 | 2863 | ||
2864 | sec = obj_find_section(f, ".this"); | 2864 | sec = obj_find_section(f, ".this"); |
2865 | if (!sec || !sec->contents) { | 2865 | if (!sec || !sec->contents) { |
2866 | perror_msg_and_die("corrupt module %s?",m_name); | 2866 | bb_perror_msg_and_die("corrupt module %s?",m_name); |
2867 | } | 2867 | } |
2868 | module = (struct new_module *) sec->contents; | 2868 | module = (struct new_module *) sec->contents; |
2869 | m_addr = sec->header.sh_addr; | 2869 | m_addr = sec->header.sh_addr; |
@@ -2927,7 +2927,7 @@ new_init_module(const char *m_name, struct obj_file *f, | |||
2927 | 2927 | ||
2928 | ret = new_sys_init_module(m_name, (struct new_module *) image); | 2928 | ret = new_sys_init_module(m_name, (struct new_module *) image); |
2929 | if (ret) | 2929 | if (ret) |
2930 | perror_msg("init_module: %s", m_name); | 2930 | bb_perror_msg("init_module: %s", m_name); |
2931 | 2931 | ||
2932 | free(image); | 2932 | free(image); |
2933 | 2933 | ||
@@ -3008,7 +3008,7 @@ static int obj_check_undefineds(struct obj_file *f) | |||
3008 | sym->value = 0; | 3008 | sym->value = 0; |
3009 | } else { | 3009 | } else { |
3010 | if (!flag_quiet) { | 3010 | if (!flag_quiet) { |
3011 | error_msg("unresolved symbol %s", sym->name); | 3011 | bb_error_msg("unresolved symbol %s", sym->name); |
3012 | } | 3012 | } |
3013 | ret = 0; | 3013 | ret = 0; |
3014 | } | 3014 | } |
@@ -3236,11 +3236,11 @@ static int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
3236 | errmsg = "Unhandled relocation"; | 3236 | errmsg = "Unhandled relocation"; |
3237 | bad_reloc: | 3237 | bad_reloc: |
3238 | if (extsym) { | 3238 | if (extsym) { |
3239 | error_msg("%s of type %ld for %s", errmsg, | 3239 | bb_error_msg("%s of type %ld for %s", errmsg, |
3240 | (long) ELFW(R_TYPE) (rel->r_info), | 3240 | (long) ELFW(R_TYPE) (rel->r_info), |
3241 | strtab + extsym->st_name); | 3241 | strtab + extsym->st_name); |
3242 | } else { | 3242 | } else { |
3243 | error_msg("%s of type %ld", errmsg, | 3243 | bb_error_msg("%s of type %ld", errmsg, |
3244 | (long) ELFW(R_TYPE) (rel->r_info)); | 3244 | (long) ELFW(R_TYPE) (rel->r_info)); |
3245 | } | 3245 | } |
3246 | ret = 0; | 3246 | ret = 0; |
@@ -3317,7 +3317,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3317 | 3317 | ||
3318 | fseek(fp, 0, SEEK_SET); | 3318 | fseek(fp, 0, SEEK_SET); |
3319 | if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { | 3319 | if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { |
3320 | perror_msg("error reading ELF header"); | 3320 | bb_perror_msg("error reading ELF header"); |
3321 | return NULL; | 3321 | return NULL; |
3322 | } | 3322 | } |
3323 | 3323 | ||
@@ -3325,25 +3325,25 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3325 | || f->header.e_ident[EI_MAG1] != ELFMAG1 | 3325 | || f->header.e_ident[EI_MAG1] != ELFMAG1 |
3326 | || f->header.e_ident[EI_MAG2] != ELFMAG2 | 3326 | || f->header.e_ident[EI_MAG2] != ELFMAG2 |
3327 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { | 3327 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { |
3328 | error_msg("not an ELF file"); | 3328 | bb_error_msg("not an ELF file"); |
3329 | return NULL; | 3329 | return NULL; |
3330 | } | 3330 | } |
3331 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM | 3331 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM |
3332 | || f->header.e_ident[EI_DATA] != ELFDATAM | 3332 | || f->header.e_ident[EI_DATA] != ELFDATAM |
3333 | || f->header.e_ident[EI_VERSION] != EV_CURRENT | 3333 | || f->header.e_ident[EI_VERSION] != EV_CURRENT |
3334 | || !MATCH_MACHINE(f->header.e_machine)) { | 3334 | || !MATCH_MACHINE(f->header.e_machine)) { |
3335 | error_msg("ELF file not for this architecture"); | 3335 | bb_error_msg("ELF file not for this architecture"); |
3336 | return NULL; | 3336 | return NULL; |
3337 | } | 3337 | } |
3338 | if (f->header.e_type != ET_REL) { | 3338 | if (f->header.e_type != ET_REL) { |
3339 | error_msg("ELF file not a relocatable object"); | 3339 | bb_error_msg("ELF file not a relocatable object"); |
3340 | return NULL; | 3340 | return NULL; |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | /* Read the section headers. */ | 3343 | /* Read the section headers. */ |
3344 | 3344 | ||
3345 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { | 3345 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { |
3346 | error_msg("section header size mismatch: %lu != %lu", | 3346 | bb_error_msg("section header size mismatch: %lu != %lu", |
3347 | (unsigned long) f->header.e_shentsize, | 3347 | (unsigned long) f->header.e_shentsize, |
3348 | (unsigned long) sizeof(ElfW(Shdr))); | 3348 | (unsigned long) sizeof(ElfW(Shdr))); |
3349 | return NULL; | 3349 | return NULL; |
@@ -3356,7 +3356,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3356 | section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); | 3356 | section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); |
3357 | fseek(fp, f->header.e_shoff, SEEK_SET); | 3357 | fseek(fp, f->header.e_shoff, SEEK_SET); |
3358 | if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { | 3358 | if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { |
3359 | perror_msg("error reading ELF section headers"); | 3359 | bb_perror_msg("error reading ELF section headers"); |
3360 | return NULL; | 3360 | return NULL; |
3361 | } | 3361 | } |
3362 | 3362 | ||
@@ -3392,7 +3392,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3392 | sec->contents = xmalloc(sec->header.sh_size); | 3392 | sec->contents = xmalloc(sec->header.sh_size); |
3393 | fseek(fp, sec->header.sh_offset, SEEK_SET); | 3393 | fseek(fp, sec->header.sh_offset, SEEK_SET); |
3394 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { | 3394 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { |
3395 | perror_msg("error reading ELF section data"); | 3395 | bb_perror_msg("error reading ELF section data"); |
3396 | return NULL; | 3396 | return NULL; |
3397 | } | 3397 | } |
3398 | } else { | 3398 | } else { |
@@ -3402,11 +3402,11 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3402 | 3402 | ||
3403 | #if SHT_RELM == SHT_REL | 3403 | #if SHT_RELM == SHT_REL |
3404 | case SHT_RELA: | 3404 | case SHT_RELA: |
3405 | error_msg("RELA relocations not supported on this architecture"); | 3405 | bb_error_msg("RELA relocations not supported on this architecture"); |
3406 | return NULL; | 3406 | return NULL; |
3407 | #else | 3407 | #else |
3408 | case SHT_REL: | 3408 | case SHT_REL: |
3409 | error_msg("REL relocations not supported on this architecture"); | 3409 | bb_error_msg("REL relocations not supported on this architecture"); |
3410 | return NULL; | 3410 | return NULL; |
3411 | #endif | 3411 | #endif |
3412 | 3412 | ||
@@ -3419,7 +3419,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3419 | break; | 3419 | break; |
3420 | } | 3420 | } |
3421 | 3421 | ||
3422 | error_msg("can't handle sections of type %ld", | 3422 | bb_error_msg("can't handle sections of type %ld", |
3423 | (long) sec->header.sh_type); | 3423 | (long) sec->header.sh_type); |
3424 | return NULL; | 3424 | return NULL; |
3425 | } | 3425 | } |
@@ -3454,7 +3454,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3454 | ElfW(Sym) * sym; | 3454 | ElfW(Sym) * sym; |
3455 | 3455 | ||
3456 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { | 3456 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { |
3457 | error_msg("symbol size mismatch: %lu != %lu", | 3457 | bb_error_msg("symbol size mismatch: %lu != %lu", |
3458 | (unsigned long) sec->header.sh_entsize, | 3458 | (unsigned long) sec->header.sh_entsize, |
3459 | (unsigned long) sizeof(ElfW(Sym))); | 3459 | (unsigned long) sizeof(ElfW(Sym))); |
3460 | return NULL; | 3460 | return NULL; |
@@ -3484,7 +3484,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
3484 | 3484 | ||
3485 | case SHT_RELM: | 3485 | case SHT_RELM: |
3486 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { | 3486 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { |
3487 | error_msg("relocation entry size mismatch: %lu != %lu", | 3487 | bb_error_msg("relocation entry size mismatch: %lu != %lu", |
3488 | (unsigned long) sec->header.sh_entsize, | 3488 | (unsigned long) sec->header.sh_entsize, |
3489 | (unsigned long) sizeof(ElfW(RelM))); | 3489 | (unsigned long) sizeof(ElfW(RelM))); |
3490 | return NULL; | 3490 | return NULL; |
@@ -3523,7 +3523,7 @@ static int obj_load_progbits(FILE * fp, struct obj_file* f, char* imagebase) | |||
3523 | sec->contents = imagebase + (sec->header.sh_addr - base); | 3523 | sec->contents = imagebase + (sec->header.sh_addr - base); |
3524 | fseek(fp, sec->header.sh_offset, SEEK_SET); | 3524 | fseek(fp, sec->header.sh_offset, SEEK_SET); |
3525 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { | 3525 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { |
3526 | error_msg("error reading ELF section data: %s\n", strerror(errno)); | 3526 | bb_error_msg("error reading ELF section data: %s\n", strerror(errno)); |
3527 | return 0; | 3527 | return 0; |
3528 | } | 3528 | } |
3529 | 3529 | ||
@@ -3710,14 +3710,14 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, | |||
3710 | }; | 3710 | }; |
3711 | 3711 | ||
3712 | if (realpath(filename, real)) { | 3712 | if (realpath(filename, real)) { |
3713 | absolute_filename = xstrdup(real); | 3713 | absolute_filename = bb_xstrdup(real); |
3714 | } | 3714 | } |
3715 | else { | 3715 | else { |
3716 | int save_errno = errno; | 3716 | int save_errno = errno; |
3717 | error_msg("cannot get realpath for %s", filename); | 3717 | bb_error_msg("cannot get realpath for %s", filename); |
3718 | errno = save_errno; | 3718 | errno = save_errno; |
3719 | perror(""); | 3719 | perror(""); |
3720 | absolute_filename = xstrdup(filename); | 3720 | absolute_filename = bb_xstrdup(filename); |
3721 | } | 3721 | } |
3722 | 3722 | ||
3723 | lm_name = strlen(m_name); | 3723 | lm_name = strlen(m_name); |
@@ -3953,7 +3953,7 @@ extern int insmod_main( int argc, char **argv) | |||
3953 | break; | 3953 | break; |
3954 | case 'o': /* name the output module */ | 3954 | case 'o': /* name the output module */ |
3955 | free(m_name); | 3955 | free(m_name); |
3956 | m_name = xstrdup(optarg); | 3956 | m_name = bb_xstrdup(optarg); |
3957 | break; | 3957 | break; |
3958 | case 'L': /* Stub warning */ | 3958 | case 'L': /* Stub warning */ |
3959 | /* This is needed for compatibility with modprobe. | 3959 | /* This is needed for compatibility with modprobe. |
@@ -3967,16 +3967,16 @@ extern int insmod_main( int argc, char **argv) | |||
3967 | break; | 3967 | break; |
3968 | #endif | 3968 | #endif |
3969 | default: | 3969 | default: |
3970 | show_usage(); | 3970 | bb_show_usage(); |
3971 | } | 3971 | } |
3972 | } | 3972 | } |
3973 | 3973 | ||
3974 | if (argv[optind] == NULL) { | 3974 | if (argv[optind] == NULL) { |
3975 | show_usage(); | 3975 | bb_show_usage(); |
3976 | } | 3976 | } |
3977 | 3977 | ||
3978 | /* Grab the module name */ | 3978 | /* Grab the module name */ |
3979 | tmp1 = xstrdup(argv[optind]); | 3979 | tmp1 = bb_xstrdup(argv[optind]); |
3980 | tmp = basename(tmp1); | 3980 | tmp = basename(tmp1); |
3981 | len = strlen(tmp); | 3981 | len = strlen(tmp); |
3982 | 3982 | ||
@@ -3985,7 +3985,7 @@ extern int insmod_main( int argc, char **argv) | |||
3985 | tmp[len] = '\0'; | 3985 | tmp[len] = '\0'; |
3986 | } | 3986 | } |
3987 | 3987 | ||
3988 | bb_asprintf(&m_fullName, "%s.o", tmp); | 3988 | bb_xasprintf(&m_fullName, "%s.o", tmp); |
3989 | 3989 | ||
3990 | if (!m_name) { | 3990 | if (!m_name) { |
3991 | m_name = tmp; | 3991 | m_name = tmp; |
@@ -4038,19 +4038,19 @@ extern int insmod_main( int argc, char **argv) | |||
4038 | if (m_filename == 0 | 4038 | if (m_filename == 0 |
4039 | || ((fp = fopen(m_filename, "r")) == NULL)) | 4039 | || ((fp = fopen(m_filename, "r")) == NULL)) |
4040 | { | 4040 | { |
4041 | error_msg("%s: no module by that name found", m_fullName); | 4041 | bb_error_msg("%s: no module by that name found", m_fullName); |
4042 | goto out; | 4042 | goto out; |
4043 | } | 4043 | } |
4044 | } else | 4044 | } else |
4045 | error_msg_and_die("%s: no module by that name found", m_fullName); | 4045 | bb_error_msg_and_die("%s: no module by that name found", m_fullName); |
4046 | } | 4046 | } |
4047 | } else | 4047 | } else |
4048 | m_filename = xstrdup(argv[optind]); | 4048 | m_filename = bb_xstrdup(argv[optind]); |
4049 | 4049 | ||
4050 | printf("Using %s\n", m_filename); | 4050 | printf("Using %s\n", m_filename); |
4051 | 4051 | ||
4052 | if ((f = obj_load(fp, LOADBITS)) == NULL) | 4052 | if ((f = obj_load(fp, LOADBITS)) == NULL) |
4053 | perror_msg_and_die("Could not load the module"); | 4053 | bb_perror_msg_and_die("Could not load the module"); |
4054 | 4054 | ||
4055 | if (get_modinfo_value(f, "kernel_version") == NULL) | 4055 | if (get_modinfo_value(f, "kernel_version") == NULL) |
4056 | m_has_modinfo = 0; | 4056 | m_has_modinfo = 0; |
@@ -4067,7 +4067,7 @@ extern int insmod_main( int argc, char **argv) | |||
4067 | } else { | 4067 | } else { |
4068 | m_version = old_get_module_version(f, m_strversion); | 4068 | m_version = old_get_module_version(f, m_strversion); |
4069 | if (m_version == -1) { | 4069 | if (m_version == -1) { |
4070 | error_msg("couldn't find the kernel version the module was " | 4070 | bb_error_msg("couldn't find the kernel version the module was " |
4071 | "compiled for"); | 4071 | "compiled for"); |
4072 | goto out; | 4072 | goto out; |
4073 | } | 4073 | } |
@@ -4075,12 +4075,12 @@ extern int insmod_main( int argc, char **argv) | |||
4075 | 4075 | ||
4076 | if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) { | 4076 | if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) { |
4077 | if (flag_force_load) { | 4077 | if (flag_force_load) { |
4078 | error_msg("Warning: kernel-module version mismatch\n" | 4078 | bb_error_msg("Warning: kernel-module version mismatch\n" |
4079 | "\t%s was compiled for kernel version %s\n" | 4079 | "\t%s was compiled for kernel version %s\n" |
4080 | "\twhile this kernel is version %s", | 4080 | "\twhile this kernel is version %s", |
4081 | m_filename, m_strversion, uts_info.release); | 4081 | m_filename, m_strversion, uts_info.release); |
4082 | } else { | 4082 | } else { |
4083 | error_msg("kernel-module version mismatch\n" | 4083 | bb_error_msg("kernel-module version mismatch\n" |
4084 | "\t%s was compiled for kernel version %s\n" | 4084 | "\t%s was compiled for kernel version %s\n" |
4085 | "\twhile this kernel is version %s.", | 4085 | "\twhile this kernel is version %s.", |
4086 | m_filename, m_strversion, uts_info.release); | 4086 | m_filename, m_strversion, uts_info.release); |
@@ -4099,7 +4099,7 @@ extern int insmod_main( int argc, char **argv) | |||
4099 | goto out; | 4099 | goto out; |
4100 | k_crcs = new_is_kernel_checksummed(); | 4100 | k_crcs = new_is_kernel_checksummed(); |
4101 | #else | 4101 | #else |
4102 | error_msg("Not configured to support new kernels"); | 4102 | bb_error_msg("Not configured to support new kernels"); |
4103 | goto out; | 4103 | goto out; |
4104 | #endif | 4104 | #endif |
4105 | } else { | 4105 | } else { |
@@ -4108,7 +4108,7 @@ extern int insmod_main( int argc, char **argv) | |||
4108 | goto out; | 4108 | goto out; |
4109 | k_crcs = old_is_kernel_checksummed(); | 4109 | k_crcs = old_is_kernel_checksummed(); |
4110 | #else | 4110 | #else |
4111 | error_msg("Not configured to support old kernels"); | 4111 | bb_error_msg("Not configured to support old kernels"); |
4112 | goto out; | 4112 | goto out; |
4113 | #endif | 4113 | #endif |
4114 | } | 4114 | } |
@@ -4170,14 +4170,14 @@ extern int insmod_main( int argc, char **argv) | |||
4170 | m_addr = create_module(m_name, m_size); | 4170 | m_addr = create_module(m_name, m_size); |
4171 | if (m_addr == -1) switch (errno) { | 4171 | if (m_addr == -1) switch (errno) { |
4172 | case EEXIST: | 4172 | case EEXIST: |
4173 | error_msg("A module named %s already exists", m_name); | 4173 | bb_error_msg("A module named %s already exists", m_name); |
4174 | goto out; | 4174 | goto out; |
4175 | case ENOMEM: | 4175 | case ENOMEM: |
4176 | error_msg("Can't allocate kernel memory for module; needed %lu bytes", | 4176 | bb_error_msg("Can't allocate kernel memory for module; needed %lu bytes", |
4177 | m_size); | 4177 | m_size); |
4178 | goto out; | 4178 | goto out; |
4179 | default: | 4179 | default: |
4180 | perror_msg("create_module: %s", m_name); | 4180 | bb_perror_msg("create_module: %s", m_name); |
4181 | goto out; | 4181 | goto out; |
4182 | } | 4182 | } |
4183 | 4183 | ||
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index b87a26a57..bb9947a23 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
@@ -108,7 +108,7 @@ extern int lsmod_main(int argc, char **argv) | |||
108 | module_names = xmalloc(bufsize = 256); | 108 | module_names = xmalloc(bufsize = 256); |
109 | if (my_query_module(NULL, QM_MODULES, (void **)&module_names, &bufsize, | 109 | if (my_query_module(NULL, QM_MODULES, (void **)&module_names, &bufsize, |
110 | &nmod)) { | 110 | &nmod)) { |
111 | perror_msg_and_die("QM_MODULES"); | 111 | bb_perror_msg_and_die("QM_MODULES"); |
112 | } | 112 | } |
113 | 113 | ||
114 | deps = xmalloc(depsize = 256); | 114 | deps = xmalloc(depsize = 256); |
@@ -122,14 +122,14 @@ extern int lsmod_main(int argc, char **argv) | |||
122 | continue; | 122 | continue; |
123 | } | 123 | } |
124 | /* else choke */ | 124 | /* else choke */ |
125 | perror_msg_and_die("module %s: QM_INFO", mn); | 125 | bb_perror_msg_and_die("module %s: QM_INFO", mn); |
126 | } | 126 | } |
127 | if (my_query_module(mn, QM_REFS, (void **)&deps, &depsize, &count)) { | 127 | if (my_query_module(mn, QM_REFS, (void **)&deps, &depsize, &count)) { |
128 | if (errno == ENOENT) { | 128 | if (errno == ENOENT) { |
129 | /* The module was removed out from underneath us. */ | 129 | /* The module was removed out from underneath us. */ |
130 | continue; | 130 | continue; |
131 | } | 131 | } |
132 | perror_msg_and_die("module %s: QM_REFS", mn); | 132 | bb_perror_msg_and_die("module %s: QM_REFS", mn); |
133 | } | 133 | } |
134 | printf("%-20s%8lu%4ld", mn, info.size, info.usecount); | 134 | printf("%-20s%8lu%4ld", mn, info.size, info.usecount); |
135 | if (info.flags & NEW_MOD_DELETED) | 135 | if (info.flags & NEW_MOD_DELETED) |
@@ -167,9 +167,10 @@ extern int lsmod_main(int argc, char **argv) | |||
167 | printf("Module Size Used by"); | 167 | printf("Module Size Used by"); |
168 | check_tainted(); | 168 | check_tainted(); |
169 | 169 | ||
170 | if(print_file_by_name("/proc/modules") == FALSE) | 170 | if (bb_xprint_file_by_name("/proc/modules") < 0) { |
171 | return 0; | ||
172 | } | ||
171 | return 1; | 173 | return 1; |
172 | return 0; | ||
173 | } | 174 | } |
174 | 175 | ||
175 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ | 176 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 99650ff03..154e66224 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -73,7 +73,7 @@ int parse_tag_value ( char *buffer, char **ptag, char **pvalue ) | |||
73 | *ptag = tag; | 73 | *ptag = tag; |
74 | *pvalue = value; | 74 | *pvalue = value; |
75 | 75 | ||
76 | return xstrlen( tag ) && xstrlen( value ); | 76 | return bb_strlen( tag ) && bb_strlen( value ); |
77 | } | 77 | } |
78 | 78 | ||
79 | /* Jump through hoops to simulate how fgets() grabs just one line at a | 79 | /* Jump through hoops to simulate how fgets() grabs just one line at a |
@@ -119,7 +119,7 @@ static struct dep_t *build_dep ( void ) | |||
119 | return 0; | 119 | return 0; |
120 | 120 | ||
121 | // check for buffer overflow in following code | 121 | // check for buffer overflow in following code |
122 | if ( xstrlen ( un.release ) > ( sizeof( buffer ) - 64 )) { | 122 | if ( bb_strlen ( un.release ) > ( sizeof( buffer ) - 64 )) { |
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
125 | 125 | ||
@@ -131,7 +131,7 @@ static struct dep_t *build_dep ( void ) | |||
131 | return 0; | 131 | return 0; |
132 | 132 | ||
133 | while ( reads ( fd, buffer, sizeof( buffer ))) { | 133 | while ( reads ( fd, buffer, sizeof( buffer ))) { |
134 | int l = xstrlen ( buffer ); | 134 | int l = bb_strlen ( buffer ); |
135 | char *p = 0; | 135 | char *p = 0; |
136 | 136 | ||
137 | while ( isspace ( buffer [l-1] )) { | 137 | while ( isspace ( buffer [l-1] )) { |
@@ -163,7 +163,7 @@ static struct dep_t *build_dep ( void ) | |||
163 | if (( *(col-2) == '.' ) && ( *(col-1) == 'o' )) | 163 | if (( *(col-2) == '.' ) && ( *(col-1) == 'o' )) |
164 | ext = 2; | 164 | ext = 2; |
165 | 165 | ||
166 | mod = xstrndup ( mods, col - mods - ext ); | 166 | mod = bb_xstrndup ( mods, col - mods - ext ); |
167 | 167 | ||
168 | if ( !current ) { | 168 | if ( !current ) { |
169 | first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); | 169 | first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); |
@@ -216,7 +216,7 @@ static struct dep_t *build_dep ( void ) | |||
216 | if ((end-deps-ext+1) <= 0) | 216 | if ((end-deps-ext+1) <= 0) |
217 | continue; | 217 | continue; |
218 | 218 | ||
219 | dep = xstrndup ( deps, end - deps - ext + 1 ); | 219 | dep = bb_xstrndup ( deps, end - deps - ext + 1 ); |
220 | 220 | ||
221 | current-> m_depcnt++; | 221 | current-> m_depcnt++; |
222 | current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt ); | 222 | current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt ); |
@@ -247,7 +247,7 @@ static struct dep_t *build_dep ( void ) | |||
247 | if ( p ) | 247 | if ( p ) |
248 | *p = 0; | 248 | *p = 0; |
249 | 249 | ||
250 | l = xstrlen ( buffer ); | 250 | l = bb_strlen ( buffer ); |
251 | 251 | ||
252 | while ( l && isspace ( buffer [l-1] )) { | 252 | while ( l && isspace ( buffer [l-1] )) { |
253 | buffer [l-1] = 0; | 253 | buffer [l-1] = 0; |
@@ -273,7 +273,7 @@ static struct dep_t *build_dep ( void ) | |||
273 | current-> m_next = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); | 273 | current-> m_next = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); |
274 | current = current-> m_next; | 274 | current = current-> m_next; |
275 | } | 275 | } |
276 | current-> m_module = xstrdup ( alias ); | 276 | current-> m_module = bb_xstrdup ( alias ); |
277 | current-> m_isalias = 1; | 277 | current-> m_isalias = 1; |
278 | 278 | ||
279 | if (( strcmp ( alias, "off" ) == 0 ) || ( strcmp ( alias, "null" ) == 0 )) { | 279 | if (( strcmp ( alias, "off" ) == 0 ) || ( strcmp ( alias, "null" ) == 0 )) { |
@@ -283,7 +283,7 @@ static struct dep_t *build_dep ( void ) | |||
283 | else { | 283 | else { |
284 | current-> m_depcnt = 1; | 284 | current-> m_depcnt = 1; |
285 | current-> m_deparr = xmalloc ( 1 * sizeof( char * )); | 285 | current-> m_deparr = xmalloc ( 1 * sizeof( char * )); |
286 | current-> m_deparr[0] = xstrdup ( mod ); | 286 | current-> m_deparr[0] = bb_xstrdup ( mod ); |
287 | } | 287 | } |
288 | current-> m_next = 0; | 288 | current-> m_next = 0; |
289 | } | 289 | } |
@@ -299,7 +299,7 @@ static struct dep_t *build_dep ( void ) | |||
299 | break; | 299 | break; |
300 | } | 300 | } |
301 | if ( dt ) { | 301 | if ( dt ) { |
302 | dt-> m_options = xrealloc ( dt-> m_options, xstrlen( opt ) + 1 ); | 302 | dt-> m_options = xrealloc ( dt-> m_options, bb_strlen( opt ) + 1 ); |
303 | strcpy ( dt-> m_options, opt ); | 303 | strcpy ( dt-> m_options, opt ); |
304 | 304 | ||
305 | // fprintf ( stderr, "OPTION: '%s' -> '%s'\n", dt-> m_module, dt-> m_options ); | 305 | // fprintf ( stderr, "OPTION: '%s' -> '%s'\n", dt-> m_module, dt-> m_options ); |
@@ -346,7 +346,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t * | |||
346 | int lm; | 346 | int lm; |
347 | 347 | ||
348 | // remove .o extension | 348 | // remove .o extension |
349 | lm = xstrlen ( mod ); | 349 | lm = bb_strlen ( mod ); |
350 | if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' )) | 350 | if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' )) |
351 | mod [lm-2] = 0; | 351 | mod [lm-2] = 0; |
352 | 352 | ||
@@ -441,7 +441,7 @@ static int mod_insert ( char *mod, int argc, char **argv ) | |||
441 | 441 | ||
442 | // append module args | 442 | // append module args |
443 | for ( i = 0; i < argc; i++ ) | 443 | for ( i = 0; i < argc; i++ ) |
444 | l += ( xstrlen ( argv [i] ) + 1 ); | 444 | l += ( bb_strlen ( argv [i] ) + 1 ); |
445 | 445 | ||
446 | head-> m_options = xrealloc ( head-> m_options, l + 1 ); | 446 | head-> m_options = xrealloc ( head-> m_options, l + 1 ); |
447 | head-> m_options [0] = 0; | 447 | head-> m_options [0] = 0; |
@@ -494,7 +494,7 @@ extern int modprobe_main(int argc, char** argv) | |||
494 | break; | 494 | break; |
495 | case 'C': // no config used | 495 | case 'C': // no config used |
496 | case 't': // no pattern matching | 496 | case 't': // no pattern matching |
497 | error_msg_and_die("-t and -C not supported"); | 497 | bb_error_msg_and_die("-t and -C not supported"); |
498 | 498 | ||
499 | case 'a': // ignore | 499 | case 'a': // ignore |
500 | case 'd': // ignore | 500 | case 'd': // ignore |
@@ -519,7 +519,7 @@ extern int modprobe_main(int argc, char** argv) | |||
519 | break; | 519 | break; |
520 | case 'V': | 520 | case 'V': |
521 | default: | 521 | default: |
522 | show_usage(); | 522 | bb_show_usage(); |
523 | break; | 523 | break; |
524 | } | 524 | } |
525 | } | 525 | } |
@@ -527,21 +527,21 @@ extern int modprobe_main(int argc, char** argv) | |||
527 | depend = build_dep ( ); | 527 | depend = build_dep ( ); |
528 | 528 | ||
529 | if ( !depend ) | 529 | if ( !depend ) |
530 | error_msg_and_die ( "could not parse modules.dep\n" ); | 530 | bb_error_msg_and_die ( "could not parse modules.dep\n" ); |
531 | 531 | ||
532 | if (remove_opt) { | 532 | if (remove_opt) { |
533 | do { | 533 | do { |
534 | mod_remove ( optind < argc ? xstrdup ( argv [optind] ) : NULL ); | 534 | mod_remove ( optind < argc ? bb_xstrdup ( argv [optind] ) : NULL ); |
535 | } while ( ++optind < argc ); | 535 | } while ( ++optind < argc ); |
536 | 536 | ||
537 | return EXIT_SUCCESS; | 537 | return EXIT_SUCCESS; |
538 | } | 538 | } |
539 | 539 | ||
540 | if (optind >= argc) | 540 | if (optind >= argc) |
541 | error_msg_and_die ( "No module or pattern provided\n" ); | 541 | bb_error_msg_and_die ( "No module or pattern provided\n" ); |
542 | 542 | ||
543 | if ( mod_insert ( xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 )) | 543 | if ( mod_insert ( bb_xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 )) |
544 | error_msg_and_die ( "failed to load module %s", argv [optind] ); | 544 | bb_error_msg_and_die ( "failed to load module %s", argv [optind] ); |
545 | 545 | ||
546 | return EXIT_SUCCESS; | 546 | return EXIT_SUCCESS; |
547 | } | 547 | } |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 0103d9145..3154b30cc 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -48,11 +48,11 @@ extern int rmmod_main(int argc, char **argv) | |||
48 | buf = xmalloc(bufsize = 256); | 48 | buf = xmalloc(bufsize = 256); |
49 | while (nmod != pnmod) { | 49 | while (nmod != pnmod) { |
50 | if (delete_module(NULL)) | 50 | if (delete_module(NULL)) |
51 | perror_msg_and_die("rmmod"); | 51 | bb_perror_msg_and_die("rmmod"); |
52 | pnmod = nmod; | 52 | pnmod = nmod; |
53 | /* 1 == QM_MODULES */ | 53 | /* 1 == QM_MODULES */ |
54 | if (my_query_module(NULL, 1, &buf, &bufsize, &nmod)) { | 54 | if (my_query_module(NULL, 1, &buf, &bufsize, &nmod)) { |
55 | perror_msg_and_die("QM_MODULES"); | 55 | bb_perror_msg_and_die("QM_MODULES"); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | #ifdef CONFIG_FEATURE_CLEAN_UP | 58 | #ifdef CONFIG_FEATURE_CLEAN_UP |
@@ -60,16 +60,16 @@ extern int rmmod_main(int argc, char **argv) | |||
60 | #endif | 60 | #endif |
61 | return EXIT_SUCCESS; | 61 | return EXIT_SUCCESS; |
62 | default: | 62 | default: |
63 | show_usage(); | 63 | bb_show_usage(); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | if (optind == argc) | 67 | if (optind == argc) |
68 | show_usage(); | 68 | bb_show_usage(); |
69 | 69 | ||
70 | for (n = optind; n < argc; n++) { | 70 | for (n = optind; n < argc; n++) { |
71 | if (delete_module(argv[n]) < 0) { | 71 | if (delete_module(argv[n]) < 0) { |
72 | perror_msg("%s", argv[n]); | 72 | bb_perror_msg("%s", argv[n]); |
73 | ret = EXIT_FAILURE; | 73 | ret = EXIT_FAILURE; |
74 | } | 74 | } |
75 | } | 75 | } |