diff options
| author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-06-02 13:40:13 +0000 |
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-06-02 13:40:13 +0000 |
| commit | ef729dd90c72d69523871b69ebb34fa367800a69 (patch) | |
| tree | 653087b8185b4418b44f2417ffe7871d5445b963 /modutils | |
| parent | d42816763f2414117d01a950c0dc2ed4dd3146eb (diff) | |
| download | busybox-w32-ef729dd90c72d69523871b69ebb34fa367800a69.tar.gz busybox-w32-ef729dd90c72d69523871b69ebb34fa367800a69.tar.bz2 busybox-w32-ef729dd90c72d69523871b69ebb34fa367800a69.zip | |
- revert revision 22183 since it breaks -b /abs /abs/path/to/mod.ko
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/depmod.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/modutils/depmod.c b/modutils/depmod.c index b2bbc7940..b0b09c235 100644 --- a/modutils/depmod.c +++ b/modutils/depmod.c | |||
| @@ -31,6 +31,7 @@ typedef struct dep_lst_t { | |||
| 31 | 31 | ||
| 32 | struct globals { | 32 | struct globals { |
| 33 | dep_lst_t *lst; /* modules without their corresponding extension */ | 33 | dep_lst_t *lst; /* modules without their corresponding extension */ |
| 34 | size_t moddir_base_len; /* length of the "-b basedir" */ | ||
| 34 | }; | 35 | }; |
| 35 | #define G (*(struct globals*)&bb_common_bufsiz1) | 36 | #define G (*(struct globals*)&bb_common_bufsiz1) |
| 36 | /* We have to zero it out because of NOEXEC */ | 37 | /* We have to zero it out because of NOEXEC */ |
| @@ -45,7 +46,7 @@ static int fill_lst(const char *modulename, struct stat ATTRIBUTE_UNUSED *sb, | |||
| 45 | */ | 46 | */ |
| 46 | if (strrstr(modulename, ".ko") != NULL) { | 47 | if (strrstr(modulename, ".ko") != NULL) { |
| 47 | dep_lst_t *new = xzalloc(sizeof(dep_lst_t)); | 48 | dep_lst_t *new = xzalloc(sizeof(dep_lst_t)); |
| 48 | new->name = xstrdup(modulename); | 49 | new->name = xstrdup(modulename + G.moddir_base_len); |
| 49 | new->next = G.lst; | 50 | new->next = G.lst; |
| 50 | G.lst = new; | 51 | G.lst = new; |
| 51 | } | 52 | } |
| @@ -81,12 +82,12 @@ static int fileAction(const char *fname, struct stat *sb, | |||
| 81 | ptr = the_module; | 82 | ptr = the_module; |
| 82 | this = G.lst; | 83 | this = G.lst; |
| 83 | do { | 84 | do { |
| 84 | if (!strcmp(fname, this->name)) | 85 | if (!strcmp(fname + G.moddir_base_len, this->name)) |
| 85 | break; | 86 | break; |
| 86 | this = this->next; | 87 | this = this->next; |
| 87 | } while (this); | 88 | } while (this); |
| 88 | dbg_assert (this); | 89 | dbg_assert (this); |
| 89 | //bb_info_msg("fname='%s'", fname); | 90 | //bb_info_msg("fname='%s'", fname + G.moddir_base_len); |
| 90 | do { | 91 | do { |
| 91 | /* search for a 'd' */ | 92 | /* search for a 'd' */ |
| 92 | ptr = memchr(ptr, 'd', len - (ptr - (char*)the_module)); | 93 | ptr = memchr(ptr, 'd', len - (ptr - (char*)the_module)); |
| @@ -156,7 +157,13 @@ int depmod_main(int ATTRIBUTE_UNUSED argc, char **argv) | |||
| 156 | option_mask32 |= *argv == NULL; | 157 | option_mask32 |= *argv == NULL; |
| 157 | 158 | ||
| 158 | if (option_mask32 & ARG_b) { | 159 | if (option_mask32 & ARG_b) { |
| 159 | xchdir(moddir_base); | 160 | G.moddir_base_len = strlen(moddir_base); |
| 161 | if (ENABLE_FEATURE_CLEAN_UP) { | ||
| 162 | chp = moddir; | ||
| 163 | moddir = concat_path_file(moddir_base, moddir); | ||
| 164 | free (chp); | ||
| 165 | } else | ||
| 166 | moddir = concat_path_file(moddir_base, moddir); | ||
| 160 | } | 167 | } |
| 161 | 168 | ||
| 162 | if (!(option_mask32 & ARG_n)) { /* --dry-run */ | 169 | if (!(option_mask32 & ARG_n)) { /* --dry-run */ |
