aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-07-19 21:33:42 +0000
committerRob Landley <rob@landley.net>2006-07-19 21:33:42 +0000
commit3b0cfb40a59c1e5537bdb44e4c8a9ad4b8a284da (patch)
tree696e6e04adf5cad0711444c2e7b5cd07d13b0651
parent3e4da920bd114b87fcfd6ff0c0bc1b5e880766f9 (diff)
downloadbusybox-3b0cfb40a59c1e5537bdb44e4c8a9ad4b8a284da.tar.gz
Patch from Yann Morin to look for modules.conf in the right place on 2.6.
Fixes http://bugs.busybox.net/view.php?id=942
-rw-r--r--modutils/modprobe.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 6211c7d81..a04377180 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -545,28 +545,36 @@ static struct dep_t *build_dep ( void )
}
close ( fd );
+ /*
+ * First parse system-specific options and aliases
+ * as they take precedence over the kernel ones.
+ */
if (!ENABLE_FEATURE_2_6_MODULES
|| ( fd = open ( "/etc/modprobe.conf", O_RDONLY )) < 0 )
if (( fd = open ( "/etc/modules.conf", O_RDONLY )) < 0 )
- if (( fd = open ( "/etc/conf.modules", O_RDONLY )) < 0 )
- return first;
+ fd = open ( "/etc/conf.modules", O_RDONLY );
- include_conf (&first, &current, buffer, sizeof(buffer), fd);
- close(fd);
+ if (fd >= 0) {
+ include_conf (&first, &current, buffer, sizeof(buffer), fd);
+ close(fd);
+ }
- filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release);
- fd = open ( filename, O_RDONLY );
- if (ENABLE_FEATURE_CLEAN_UP)
- free(filename);
- if (fd < 0) {
- /* Ok, that didn't work. Fall back to looking in /lib/modules */
- if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) {
- return first;
+ /* Only 2.6 has a modules.alias file */
+ if (ENABLE_FEATURE_2_6_MODULES) {
+ /* Parse kernel-declared aliases */
+ filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release);
+ if ((fd = open ( filename, O_RDONLY )) < 0) {
+ /* Ok, that didn't work. Fall back to looking in /lib/modules */
+ fd = open ( "/lib/modules/modules.alias", O_RDONLY );
}
- }
+ if (ENABLE_FEATURE_CLEAN_UP)
+ free(filename);
- include_conf (&first, &current, buffer, sizeof(buffer), fd);
- close(fd);
+ if (fd >= 0) {
+ include_conf (&first, &current, buffer, sizeof(buffer), fd);
+ close(fd);
+ }
+ }
return first;
}