summaryrefslogtreecommitdiffhomepage
path: root/modutils/insmod.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-04-06 11:56:26 +0000
committerEric Andersen <andersen@codepoet.org>2004-04-06 11:56:26 +0000
commit3f47c453daa4509729fa8a54f58c0291099d01c4 (patch)
treeb76a80412fce98e865f0e7e756ef8fc6ed8c8151 /modutils/insmod.c
parentb07ae7ba1064fb54f46ee2609dfbdbdbaaaa8624 (diff)
Christian Grigis, christian.grigis at smartdata dot ch writes:
Hello everyone, Busybox's insmod fails to locate a module when that module is the only one existing in the /lib/modules directory (with a unique name). Example: # find /lib/modules/ -type f /lib/modules/kernel/drivers/char/bios.o # insmod bios insmod: bios.o: no module by that name found # touch /lib/modules/dummy # find /lib/modules/ -type f /lib/modules/kernel/drivers/char/bios.o /lib/modules/dummy # insmod bios Using /lib/modules/kernel/drivers/char/bios.o As long as there is another file in the /lib/modules directory, insmod finds it OK. I tracked the problem down to 'check_module_name_match()' in insmod.c: It returns TRUE when a match is found, and FALSE otherwise. In the case where there is only one module in the /lib/modules directory (or more that one module, but all with the same name), 'recursive_action()' will return TRUE and we end up on line 4196 in 'insmod.c' which returns an error. [The reason it works with more than one module with different names is that in this case there will always be one not matching, 'recursive_action()' will return FALSE and we end up in line 4189.] Now, from the implementation of 'recursive_action()' and from other usages of it (tar.c, etc.), it seems to me that FALSE should be returned to indicate that we want to stop the recursion, so TRUE and FALSE should be inverted in 'check_module_name_match()'. At the same time, 'recursive_action()' continues to recurse even after the recursive call has returned FALSE; again in my understanding and other usages of it, we can safely stop recursing at this point. Here is my patch against 1.00-pre8:
Diffstat (limited to 'modutils/insmod.c')
-rw-r--r--modutils/insmod.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 455b1c10c..d788a76c3 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -282,7 +282,7 @@ extern int insmod_ng_main( int argc, char **argv);
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.115 2004/03/19 12:17:04 andersen Exp $"
+#ident "$Id: insmod.c,v 1.116 2004/04/06 11:56:26 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -503,7 +503,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.115 2004/03/19 12:17:04 andersen Exp $"
+#ident "$Id: insmod.c,v 1.116 2004/04/06 11:56:26 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -811,11 +811,11 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
free(tmp1);
/* Stop searching if we find a match */
m_filename = bb_xstrdup(filename);
- return (TRUE);
+ return (FALSE);
}
free(tmp1);
}
- return (FALSE);
+ return (TRUE);
}