aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-06-02 13:34:36 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-06-02 13:34:36 +0000
commitd42816763f2414117d01a950c0dc2ed4dd3146eb (patch)
treee4b86f265396a39923f359a57cdbc7d79af2a10a /modutils
parentbeac1bd58e231f8b1664c767dc128a1d86b27fff (diff)
downloadbusybox-w32-d42816763f2414117d01a950c0dc2ed4dd3146eb.tar.gz
busybox-w32-d42816763f2414117d01a950c0dc2ed4dd3146eb.tar.bz2
busybox-w32-d42816763f2414117d01a950c0dc2ed4dd3146eb.zip
- just chdir to the basedir (-30b).
Diffstat (limited to 'modutils')
-rw-r--r--modutils/depmod.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/modutils/depmod.c b/modutils/depmod.c
index b0b09c235..b2bbc7940 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -31,7 +31,6 @@ typedef struct dep_lst_t {
31 31
32struct globals { 32struct 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" */
35}; 34};
36#define G (*(struct globals*)&bb_common_bufsiz1) 35#define G (*(struct globals*)&bb_common_bufsiz1)
37/* We have to zero it out because of NOEXEC */ 36/* We have to zero it out because of NOEXEC */
@@ -46,7 +45,7 @@ static int fill_lst(const char *modulename, struct stat ATTRIBUTE_UNUSED *sb,
46 */ 45 */
47 if (strrstr(modulename, ".ko") != NULL) { 46 if (strrstr(modulename, ".ko") != NULL) {
48 dep_lst_t *new = xzalloc(sizeof(dep_lst_t)); 47 dep_lst_t *new = xzalloc(sizeof(dep_lst_t));
49 new->name = xstrdup(modulename + G.moddir_base_len); 48 new->name = xstrdup(modulename);
50 new->next = G.lst; 49 new->next = G.lst;
51 G.lst = new; 50 G.lst = new;
52 } 51 }
@@ -82,12 +81,12 @@ static int fileAction(const char *fname, struct stat *sb,
82 ptr = the_module; 81 ptr = the_module;
83 this = G.lst; 82 this = G.lst;
84 do { 83 do {
85 if (!strcmp(fname + G.moddir_base_len, this->name)) 84 if (!strcmp(fname, this->name))
86 break; 85 break;
87 this = this->next; 86 this = this->next;
88 } while (this); 87 } while (this);
89 dbg_assert (this); 88 dbg_assert (this);
90//bb_info_msg("fname='%s'", fname + G.moddir_base_len); 89//bb_info_msg("fname='%s'", fname);
91 do { 90 do {
92 /* search for a 'd' */ 91 /* search for a 'd' */
93 ptr = memchr(ptr, 'd', len - (ptr - (char*)the_module)); 92 ptr = memchr(ptr, 'd', len - (ptr - (char*)the_module));
@@ -157,13 +156,7 @@ int depmod_main(int ATTRIBUTE_UNUSED argc, char **argv)
157 option_mask32 |= *argv == NULL; 156 option_mask32 |= *argv == NULL;
158 157
159 if (option_mask32 & ARG_b) { 158 if (option_mask32 & ARG_b) {
160 G.moddir_base_len = strlen(moddir_base); 159 xchdir(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);
167 } 160 }
168 161
169 if (!(option_mask32 & ARG_n)) { /* --dry-run */ 162 if (!(option_mask32 & ARG_n)) { /* --dry-run */