diff options
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 54 | ||||
| -rw-r--r-- | modutils/modprobe.c | 35 |
2 files changed, 24 insertions, 65 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 3113f7446..be41e4449 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -59,17 +59,6 @@ | |||
| 59 | */ | 59 | */ |
| 60 | 60 | ||
| 61 | #include "busybox.h" | 61 | #include "busybox.h" |
| 62 | #include <stdlib.h> | ||
| 63 | #include <stdio.h> | ||
| 64 | #include <stddef.h> | ||
| 65 | #include <errno.h> | ||
| 66 | #include <unistd.h> | ||
| 67 | #include <dirent.h> | ||
| 68 | #include <ctype.h> | ||
| 69 | #include <assert.h> | ||
| 70 | #include <string.h> | ||
| 71 | #include <getopt.h> | ||
| 72 | #include <fcntl.h> | ||
| 73 | #include <sys/utsname.h> | 62 | #include <sys/utsname.h> |
| 74 | 63 | ||
| 75 | #if !defined(CONFIG_FEATURE_2_4_MODULES) && \ | 64 | #if !defined(CONFIG_FEATURE_2_4_MODULES) && \ |
| @@ -804,12 +793,12 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, | |||
| 804 | if (fullname[0] == '\0') | 793 | if (fullname[0] == '\0') |
| 805 | return (FALSE); | 794 | return (FALSE); |
| 806 | else { | 795 | else { |
| 807 | char *tmp, *tmp1 = bb_xstrdup(filename); | 796 | char *tmp, *tmp1 = xstrdup(filename); |
| 808 | tmp = bb_get_last_path_component(tmp1); | 797 | tmp = bb_get_last_path_component(tmp1); |
| 809 | if (strcmp(tmp, fullname) == 0) { | 798 | if (strcmp(tmp, fullname) == 0) { |
| 810 | free(tmp1); | 799 | free(tmp1); |
| 811 | /* Stop searching if we find a match */ | 800 | /* Stop searching if we find a match */ |
| 812 | m_filename = bb_xstrdup(filename); | 801 | m_filename = xstrdup(filename); |
| 813 | return (FALSE); | 802 | return (FALSE); |
| 814 | } | 803 | } |
| 815 | free(tmp1); | 804 | free(tmp1); |
| @@ -893,7 +882,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 893 | * (which is .got) similar to branch, | 882 | * (which is .got) similar to branch, |
| 894 | * but is full 32 bits relative */ | 883 | * but is full 32 bits relative */ |
| 895 | 884 | ||
| 896 | assert(got != 0); | ||
| 897 | *loc += got - dot; | 885 | *loc += got - dot; |
| 898 | break; | 886 | break; |
| 899 | 887 | ||
| @@ -902,7 +890,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 902 | goto bb_use_plt; | 890 | goto bb_use_plt; |
| 903 | 891 | ||
| 904 | case R_ARM_GOTOFF: /* address relative to the got */ | 892 | case R_ARM_GOTOFF: /* address relative to the got */ |
| 905 | assert(got != 0); | ||
| 906 | *loc += v - got; | 893 | *loc += v - got; |
| 907 | break; | 894 | break; |
| 908 | 895 | ||
| @@ -972,7 +959,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 972 | break; | 959 | break; |
| 973 | 960 | ||
| 974 | case R_386_GOTPC: | 961 | case R_386_GOTPC: |
| 975 | assert(got != 0); | ||
| 976 | *loc += got - dot; | 962 | *loc += got - dot; |
| 977 | break; | 963 | break; |
| 978 | 964 | ||
| @@ -980,7 +966,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 980 | goto bb_use_got; | 966 | goto bb_use_got; |
| 981 | 967 | ||
| 982 | case R_386_GOTOFF: | 968 | case R_386_GOTOFF: |
| 983 | assert(got != 0); | ||
| 984 | *loc += v - got; | 969 | *loc += v - got; |
| 985 | break; | 970 | break; |
| 986 | 971 | ||
| @@ -1102,7 +1087,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1102 | 1087 | ||
| 1103 | # ifdef R_68K_GOTOFF | 1088 | # ifdef R_68K_GOTOFF |
| 1104 | case R_68K_GOTOFF: | 1089 | case R_68K_GOTOFF: |
| 1105 | assert(got != 0); | ||
| 1106 | *loc += v - got; | 1090 | *loc += v - got; |
| 1107 | break; | 1091 | break; |
| 1108 | # endif | 1092 | # endif |
| @@ -1157,9 +1141,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1157 | struct mips_hi16 *next; | 1141 | struct mips_hi16 *next; |
| 1158 | unsigned long insn; | 1142 | unsigned long insn; |
| 1159 | 1143 | ||
| 1160 | /* The value for the HI16 had best be the same. */ | ||
| 1161 | assert(v == l->value); | ||
| 1162 | |||
| 1163 | /* Do the HI16 relocation. Note that we actually don't | 1144 | /* Do the HI16 relocation. Note that we actually don't |
| 1164 | need to know anything about the LO16 itself, except where | 1145 | need to know anything about the LO16 itself, except where |
| 1165 | to find the low 16 bits of the addend needed by the LO16. */ | 1146 | to find the low 16 bits of the addend needed by the LO16. */ |
| @@ -1408,9 +1389,7 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1408 | case R_390_PLT32: | 1389 | case R_390_PLT32: |
| 1409 | case R_390_PLT16DBL: | 1390 | case R_390_PLT16DBL: |
| 1410 | /* find the plt entry and initialize it. */ | 1391 | /* find the plt entry and initialize it. */ |
| 1411 | assert(isym != NULL); | ||
| 1412 | pe = (struct arch_single_entry *) &isym->pltent; | 1392 | pe = (struct arch_single_entry *) &isym->pltent; |
| 1413 | assert(pe->allocated); | ||
| 1414 | if (pe->inited == 0) { | 1393 | if (pe->inited == 0) { |
| 1415 | ip = (unsigned long *)(ifile->plt->contents + pe->offset); | 1394 | ip = (unsigned long *)(ifile->plt->contents + pe->offset); |
| 1416 | ip[0] = 0x0d105810; /* basr 1,0; lg 1,10(1); br 1 */ | 1395 | ip[0] = 0x0d105810; /* basr 1,0; lg 1,10(1); br 1 */ |
| @@ -1440,15 +1419,12 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1440 | break; | 1419 | break; |
| 1441 | 1420 | ||
| 1442 | case R_390_GOTPC: | 1421 | case R_390_GOTPC: |
| 1443 | assert(got != 0); | ||
| 1444 | *(unsigned long *) loc += got - dot; | 1422 | *(unsigned long *) loc += got - dot; |
| 1445 | break; | 1423 | break; |
| 1446 | 1424 | ||
| 1447 | case R_390_GOT12: | 1425 | case R_390_GOT12: |
| 1448 | case R_390_GOT16: | 1426 | case R_390_GOT16: |
| 1449 | case R_390_GOT32: | 1427 | case R_390_GOT32: |
| 1450 | assert(isym != NULL); | ||
| 1451 | assert(got != 0); | ||
| 1452 | if (!isym->gotent.inited) | 1428 | if (!isym->gotent.inited) |
| 1453 | { | 1429 | { |
| 1454 | isym->gotent.inited = 1; | 1430 | isym->gotent.inited = 1; |
| @@ -1466,7 +1442,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1466 | # define R_390_GOTOFF32 R_390_GOTOFF | 1442 | # define R_390_GOTOFF32 R_390_GOTOFF |
| 1467 | # endif | 1443 | # endif |
| 1468 | case R_390_GOTOFF32: | 1444 | case R_390_GOTOFF32: |
| 1469 | assert(got != 0); | ||
| 1470 | *loc += v - got; | 1445 | *loc += v - got; |
| 1471 | break; | 1446 | break; |
| 1472 | 1447 | ||
| @@ -1497,7 +1472,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1497 | break; | 1472 | break; |
| 1498 | 1473 | ||
| 1499 | case R_SH_GOTPC: | 1474 | case R_SH_GOTPC: |
| 1500 | assert(got != 0); | ||
| 1501 | *loc = got - dot + rel->r_addend; | 1475 | *loc = got - dot + rel->r_addend; |
| 1502 | break; | 1476 | break; |
| 1503 | 1477 | ||
| @@ -1505,7 +1479,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1505 | goto bb_use_got; | 1479 | goto bb_use_got; |
| 1506 | 1480 | ||
| 1507 | case R_SH_GOTOFF: | 1481 | case R_SH_GOTOFF: |
| 1508 | assert(got != 0); | ||
| 1509 | *loc = v - got; | 1482 | *loc = v - got; |
| 1510 | break; | 1483 | break; |
| 1511 | 1484 | ||
| @@ -1627,7 +1600,6 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1627 | case R_X86_64_GOTPCREL: | 1600 | case R_X86_64_GOTPCREL: |
| 1628 | goto bb_use_got; | 1601 | goto bb_use_got; |
| 1629 | # if 0 | 1602 | # if 0 |
| 1630 | assert(isym != NULL); | ||
| 1631 | if (!isym->gotent.reloc_done) | 1603 | if (!isym->gotent.reloc_done) |
| 1632 | { | 1604 | { |
| 1633 | isym->gotent.reloc_done = 1; | 1605 | isym->gotent.reloc_done = 1; |
| @@ -1655,12 +1627,10 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1655 | bb_use_plt: | 1627 | bb_use_plt: |
| 1656 | 1628 | ||
| 1657 | /* find the plt entry and initialize it if necessary */ | 1629 | /* find the plt entry and initialize it if necessary */ |
| 1658 | assert(isym != NULL); | ||
| 1659 | 1630 | ||
| 1660 | #if defined(CONFIG_USE_PLT_LIST) | 1631 | #if defined(CONFIG_USE_PLT_LIST) |
| 1661 | for (pe = isym->pltent; pe != NULL && pe->addend != rel->r_addend;) | 1632 | for (pe = isym->pltent; pe != NULL && pe->addend != rel->r_addend;) |
| 1662 | pe = pe->next; | 1633 | pe = pe->next; |
| 1663 | assert(pe != NULL); | ||
| 1664 | #else | 1634 | #else |
| 1665 | pe = &isym->pltent; | 1635 | pe = &isym->pltent; |
| 1666 | #endif | 1636 | #endif |
| @@ -1734,7 +1704,6 @@ bb_use_plt: | |||
| 1734 | #if defined(CONFIG_USE_GOT_ENTRIES) | 1704 | #if defined(CONFIG_USE_GOT_ENTRIES) |
| 1735 | bb_use_got: | 1705 | bb_use_got: |
| 1736 | 1706 | ||
| 1737 | assert(isym != NULL); | ||
| 1738 | /* needs an entry in the .got: set it, once */ | 1707 | /* needs an entry in the .got: set it, once */ |
| 1739 | if (!isym->gotent.inited) { | 1708 | if (!isym->gotent.inited) { |
| 1740 | isym->gotent.inited = 1; | 1709 | isym->gotent.inited = 1; |
| @@ -1814,7 +1783,6 @@ static struct obj_section *arch_xsect_init(struct obj_file *f, char *name, | |||
| 1814 | } else { | 1783 | } else { |
| 1815 | myrelsec = obj_create_alloced_section(f, name, | 1784 | myrelsec = obj_create_alloced_section(f, name, |
| 1816 | size, offset); | 1785 | size, offset); |
| 1817 | assert(myrelsec); | ||
| 1818 | } | 1786 | } |
| 1819 | 1787 | ||
| 1820 | return myrelsec; | 1788 | return myrelsec; |
| @@ -3778,14 +3746,14 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, | |||
| 3778 | }; | 3746 | }; |
| 3779 | 3747 | ||
| 3780 | if (realpath(filename, real)) { | 3748 | if (realpath(filename, real)) { |
| 3781 | absolute_filename = bb_xstrdup(real); | 3749 | absolute_filename = xstrdup(real); |
| 3782 | } | 3750 | } |
| 3783 | else { | 3751 | else { |
| 3784 | int save_errno = errno; | 3752 | int save_errno = errno; |
| 3785 | bb_error_msg("cannot get realpath for %s", filename); | 3753 | bb_error_msg("cannot get realpath for %s", filename); |
| 3786 | errno = save_errno; | 3754 | errno = save_errno; |
| 3787 | perror(""); | 3755 | perror(""); |
| 3788 | absolute_filename = bb_xstrdup(filename); | 3756 | absolute_filename = xstrdup(filename); |
| 3789 | } | 3757 | } |
| 3790 | 3758 | ||
| 3791 | lm_name = strlen(m_name); | 3759 | lm_name = strlen(m_name); |
| @@ -4022,7 +3990,7 @@ int insmod_main( int argc, char **argv) | |||
| 4022 | break; | 3990 | break; |
| 4023 | case 'o': /* name the output module */ | 3991 | case 'o': /* name the output module */ |
| 4024 | free(m_name); | 3992 | free(m_name); |
| 4025 | m_name = bb_xstrdup(optarg); | 3993 | m_name = xstrdup(optarg); |
| 4026 | break; | 3994 | break; |
| 4027 | case 'L': /* Stub warning */ | 3995 | case 'L': /* Stub warning */ |
| 4028 | /* This is needed for compatibility with modprobe. | 3996 | /* This is needed for compatibility with modprobe. |
| @@ -4045,7 +4013,7 @@ int insmod_main( int argc, char **argv) | |||
| 4045 | } | 4013 | } |
| 4046 | 4014 | ||
| 4047 | /* Grab the module name */ | 4015 | /* Grab the module name */ |
| 4048 | tmp1 = bb_xstrdup(argv[optind]); | 4016 | tmp1 = xstrdup(argv[optind]); |
| 4049 | tmp = basename(tmp1); | 4017 | tmp = basename(tmp1); |
| 4050 | len = strlen(tmp); | 4018 | len = strlen(tmp); |
| 4051 | 4019 | ||
| @@ -4071,10 +4039,10 @@ int insmod_main( int argc, char **argv) | |||
| 4071 | 4039 | ||
| 4072 | #if defined(CONFIG_FEATURE_2_6_MODULES) | 4040 | #if defined(CONFIG_FEATURE_2_6_MODULES) |
| 4073 | if (k_version > 4) | 4041 | if (k_version > 4) |
| 4074 | m_fullName = bb_xasprintf("%s.ko", tmp); | 4042 | m_fullName = xasprintf("%s.ko", tmp); |
| 4075 | else | 4043 | else |
| 4076 | #endif | 4044 | #endif |
| 4077 | m_fullName = bb_xasprintf("%s.o", tmp); | 4045 | m_fullName = xasprintf("%s.o", tmp); |
| 4078 | 4046 | ||
| 4079 | if (!m_name) { | 4047 | if (!m_name) { |
| 4080 | m_name = tmp; | 4048 | m_name = tmp; |
| @@ -4132,7 +4100,7 @@ int insmod_main( int argc, char **argv) | |||
| 4132 | bb_error_msg_and_die("%s: no module by that name found", m_fullName); | 4100 | bb_error_msg_and_die("%s: no module by that name found", m_fullName); |
| 4133 | } | 4101 | } |
| 4134 | } else | 4102 | } else |
| 4135 | m_filename = bb_xstrdup(argv[optind]); | 4103 | m_filename = xstrdup(argv[optind]); |
| 4136 | 4104 | ||
| 4137 | if (flag_verbose) | 4105 | if (flag_verbose) |
| 4138 | printf("Using %s\n", m_filename); | 4106 | printf("Using %s\n", m_filename); |
| @@ -4334,7 +4302,7 @@ int insmod_ng_main( int argc, char **argv) | |||
| 4334 | struct stat st; | 4302 | struct stat st; |
| 4335 | unsigned long len; | 4303 | unsigned long len; |
| 4336 | void *map; | 4304 | void *map; |
| 4337 | char *filename, *options = bb_xstrdup(""); | 4305 | char *filename, *options = xstrdup(""); |
| 4338 | 4306 | ||
| 4339 | filename = argv[1]; | 4307 | filename = argv[1]; |
| 4340 | if (!filename) { | 4308 | if (!filename) { |
| @@ -4356,7 +4324,7 @@ int insmod_ng_main( int argc, char **argv) | |||
| 4356 | strcat(options, " "); | 4324 | strcat(options, " "); |
| 4357 | } | 4325 | } |
| 4358 | 4326 | ||
| 4359 | fd = bb_xopen3(filename, O_RDONLY, 0); | 4327 | fd = xopen3(filename, O_RDONLY, 0); |
| 4360 | 4328 | ||
| 4361 | fstat(fd, &st); | 4329 | fstat(fd, &st); |
| 4362 | len = st.st_size; | 4330 | len = st.st_size; |
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index b11e58d55..5a94c7c92 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
| @@ -13,15 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | #include "busybox.h" | 14 | #include "busybox.h" |
| 15 | #include <sys/utsname.h> | 15 | #include <sys/utsname.h> |
| 16 | #include <sys/types.h> | ||
| 17 | #include <sys/wait.h> | ||
| 18 | #include <getopt.h> | ||
| 19 | #include <stdlib.h> | ||
| 20 | #include <unistd.h> | ||
| 21 | #include <syslog.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <ctype.h> | ||
| 24 | #include <fcntl.h> | ||
| 25 | #include <fnmatch.h> | 16 | #include <fnmatch.h> |
| 26 | 17 | ||
| 27 | struct mod_opt_t { /* one-way list of options to pass to a module */ | 18 | struct mod_opt_t { /* one-way list of options to pass to a module */ |
| @@ -148,7 +139,7 @@ static struct mod_opt_t *append_option( struct mod_opt_t *opt_list, char *opt ) | |||
| 148 | ol = opt_list = xmalloc( sizeof( struct mod_opt_t ) ); | 139 | ol = opt_list = xmalloc( sizeof( struct mod_opt_t ) ); |
| 149 | } | 140 | } |
| 150 | 141 | ||
| 151 | ol-> m_opt_val = bb_xstrdup( opt ); | 142 | ol-> m_opt_val = xstrdup( opt ); |
| 152 | ol-> m_next = NULL; | 143 | ol-> m_next = NULL; |
| 153 | 144 | ||
| 154 | return opt_list; | 145 | return opt_list; |
| @@ -160,7 +151,7 @@ static struct mod_opt_t *append_option( struct mod_opt_t *opt_list, char *opt ) | |||
| 160 | * dst: pointer to where to store the parsed argument | 151 | * dst: pointer to where to store the parsed argument |
| 161 | * return value: the pointer to the first char after the parsed argument, | 152 | * return value: the pointer to the first char after the parsed argument, |
| 162 | * NULL if there was no argument parsed (only trailing spaces). | 153 | * NULL if there was no argument parsed (only trailing spaces). |
| 163 | * Note that memory is allocated with bb_xstrdup when a new argument was | 154 | * Note that memory is allocated with xstrdup when a new argument was |
| 164 | * parsed. Don't forget to free it! | 155 | * parsed. Don't forget to free it! |
| 165 | */ | 156 | */ |
| 166 | #define ARG_EMPTY 0x00 | 157 | #define ARG_EMPTY 0x00 |
| @@ -185,7 +176,7 @@ static char *parse_command_string( char *src, char **dst ) | |||
| 185 | /* Reached the start of an argument | 176 | /* Reached the start of an argument |
| 186 | * By the way, we duplicate a little too much | 177 | * By the way, we duplicate a little too much |
| 187 | * here but what is too much is freed later. */ | 178 | * here but what is too much is freed later. */ |
| 188 | *dst = tmp_str = bb_xstrdup( src ); | 179 | *dst = tmp_str = xstrdup( src ); |
| 189 | /* Get to the end of that argument */ | 180 | /* Get to the end of that argument */ |
| 190 | while( ( *tmp_str != '\0' ) | 181 | while( ( *tmp_str != '\0' ) |
| 191 | && ( ( *tmp_str != ' ' ) | 182 | && ( ( *tmp_str != ' ' ) |
| @@ -309,7 +300,7 @@ static void include_conf ( struct dep_t **first, struct dep_t **current, char *b | |||
| 309 | (*current)-> m_next = (struct dep_t *) xcalloc ( 1, sizeof ( struct dep_t )); | 300 | (*current)-> m_next = (struct dep_t *) xcalloc ( 1, sizeof ( struct dep_t )); |
| 310 | (*current) = (*current)-> m_next; | 301 | (*current) = (*current)-> m_next; |
| 311 | } | 302 | } |
| 312 | (*current)-> m_name = bb_xstrdup ( alias ); | 303 | (*current)-> m_name = xstrdup ( alias ); |
| 313 | (*current)-> m_isalias = 1; | 304 | (*current)-> m_isalias = 1; |
| 314 | 305 | ||
| 315 | if (( strcmp ( mod, "off" ) == 0 ) || ( strcmp ( mod, "null" ) == 0 )) { | 306 | if (( strcmp ( mod, "off" ) == 0 ) || ( strcmp ( mod, "null" ) == 0 )) { |
| @@ -319,7 +310,7 @@ static void include_conf ( struct dep_t **first, struct dep_t **current, char *b | |||
| 319 | else { | 310 | else { |
| 320 | (*current)-> m_depcnt = 1; | 311 | (*current)-> m_depcnt = 1; |
| 321 | (*current)-> m_deparr = xmalloc ( 1 * sizeof( char * )); | 312 | (*current)-> m_deparr = xmalloc ( 1 * sizeof( char * )); |
| 322 | (*current)-> m_deparr[0] = bb_xstrdup ( mod ); | 313 | (*current)-> m_deparr[0] = xstrdup ( mod ); |
| 323 | } | 314 | } |
| 324 | (*current)-> m_next = 0; | 315 | (*current)-> m_next = 0; |
| 325 | } | 316 | } |
| @@ -388,7 +379,7 @@ static struct dep_t *build_dep ( void ) | |||
| 388 | k_version = un.release[2] - '0'; | 379 | k_version = un.release[2] - '0'; |
| 389 | } | 380 | } |
| 390 | 381 | ||
| 391 | filename = bb_xasprintf("/lib/modules/%s/modules.dep", un.release ); | 382 | filename = xasprintf("/lib/modules/%s/modules.dep", un.release ); |
| 392 | fd = open ( filename, O_RDONLY ); | 383 | fd = open ( filename, O_RDONLY ); |
| 393 | if (ENABLE_FEATURE_CLEAN_UP) | 384 | if (ENABLE_FEATURE_CLEAN_UP) |
| 394 | free(filename); | 385 | free(filename); |
| @@ -447,7 +438,7 @@ static struct dep_t *build_dep ( void ) | |||
| 447 | if (( *(col-2) == '.' ) && ( *(col-1) == 'o' )) | 438 | if (( *(col-2) == '.' ) && ( *(col-1) == 'o' )) |
| 448 | dot = col - 2; | 439 | dot = col - 2; |
| 449 | 440 | ||
| 450 | mod = bb_xstrndup ( mods, dot - mods ); | 441 | mod = xstrndup ( mods, dot - mods ); |
| 451 | 442 | ||
| 452 | /* enqueue new module */ | 443 | /* enqueue new module */ |
| 453 | if ( !current ) { | 444 | if ( !current ) { |
| @@ -458,7 +449,7 @@ static struct dep_t *build_dep ( void ) | |||
| 458 | current = current-> m_next; | 449 | current = current-> m_next; |
| 459 | } | 450 | } |
| 460 | current-> m_name = mod; | 451 | current-> m_name = mod; |
| 461 | current-> m_path = bb_xstrdup(modpath); | 452 | current-> m_path = xstrdup(modpath); |
| 462 | current-> m_options = NULL; | 453 | current-> m_options = NULL; |
| 463 | current-> m_isalias = 0; | 454 | current-> m_isalias = 0; |
| 464 | current-> m_depcnt = 0; | 455 | current-> m_depcnt = 0; |
| @@ -525,7 +516,7 @@ static struct dep_t *build_dep ( void ) | |||
| 525 | /* Cope with blank lines */ | 516 | /* Cope with blank lines */ |
| 526 | if ((next-deps-ext+1) <= 0) | 517 | if ((next-deps-ext+1) <= 0) |
| 527 | continue; | 518 | continue; |
| 528 | dep = bb_xstrndup ( deps, next - deps - ext + 1 ); | 519 | dep = xstrndup ( deps, next - deps - ext + 1 ); |
| 529 | 520 | ||
| 530 | /* Add the new dependable module name */ | 521 | /* Add the new dependable module name */ |
| 531 | current-> m_depcnt++; | 522 | current-> m_depcnt++; |
| @@ -562,7 +553,7 @@ static struct dep_t *build_dep ( void ) | |||
| 562 | /* Only 2.6 has a modules.alias file */ | 553 | /* Only 2.6 has a modules.alias file */ |
| 563 | if (ENABLE_FEATURE_2_6_MODULES) { | 554 | if (ENABLE_FEATURE_2_6_MODULES) { |
| 564 | /* Parse kernel-declared aliases */ | 555 | /* Parse kernel-declared aliases */ |
| 565 | filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release); | 556 | filename = xasprintf("/lib/modules/%s/modules.alias", un.release); |
| 566 | if ((fd = open ( filename, O_RDONLY )) < 0) { | 557 | if ((fd = open ( filename, O_RDONLY )) < 0) { |
| 567 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 558 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
| 568 | fd = open ( "/lib/modules/modules.alias", O_RDONLY ); | 559 | fd = open ( "/lib/modules/modules.alias", O_RDONLY ); |
| @@ -687,7 +678,7 @@ static int mod_process ( struct mod_list_t *list, int do_insert ) | |||
| 687 | printf("%s module %s\n", do_insert?"Loading":"Unloading", list-> m_name ); | 678 | printf("%s module %s\n", do_insert?"Loading":"Unloading", list-> m_name ); |
| 688 | } | 679 | } |
| 689 | if (!show_only) { | 680 | if (!show_only) { |
| 690 | int rc2 = wait4pid(bb_spawn(argv)); | 681 | int rc2 = wait4pid(spawn(argv)); |
| 691 | 682 | ||
| 692 | if (do_insert) { | 683 | if (do_insert) { |
| 693 | rc = rc2; /* only last module matters */ | 684 | rc = rc2; /* only last module matters */ |
| @@ -724,8 +715,8 @@ static int check_pattern( const char* pat_src, const char* mod_src ) { | |||
| 724 | char* mod; | 715 | char* mod; |
| 725 | char* p; | 716 | char* p; |
| 726 | 717 | ||
| 727 | pat = bb_xstrdup (pat_src); | 718 | pat = xstrdup (pat_src); |
| 728 | mod = bb_xstrdup (mod_src); | 719 | mod = xstrdup (mod_src); |
| 729 | 720 | ||
| 730 | for (p = pat; (p = strchr(p, '-')); *p++ = '_' ); | 721 | for (p = pat; (p = strchr(p, '-')); *p++ = '_' ); |
| 731 | for (p = mod; (p = strchr(p, '-')); *p++ = '_' ); | 722 | for (p = mod; (p = strchr(p, '-')); *p++ = '_' ); |
