diff options
author | Rob Landley <rob@landley.net> | 2006-07-19 21:33:42 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-07-19 21:33:42 +0000 |
commit | 3b0cfb40a59c1e5537bdb44e4c8a9ad4b8a284da (patch) | |
tree | 696e6e04adf5cad0711444c2e7b5cd07d13b0651 | |
parent | 3e4da920bd114b87fcfd6ff0c0bc1b5e880766f9 (diff) | |
download | busybox-w32-3b0cfb40a59c1e5537bdb44e4c8a9ad4b8a284da.tar.gz busybox-w32-3b0cfb40a59c1e5537bdb44e4c8a9ad4b8a284da.tar.bz2 busybox-w32-3b0cfb40a59c1e5537bdb44e4c8a9ad4b8a284da.zip |
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.c | 38 |
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 ) | |||
545 | } | 545 | } |
546 | close ( fd ); | 546 | close ( fd ); |
547 | 547 | ||
548 | /* | ||
549 | * First parse system-specific options and aliases | ||
550 | * as they take precedence over the kernel ones. | ||
551 | */ | ||
548 | if (!ENABLE_FEATURE_2_6_MODULES | 552 | if (!ENABLE_FEATURE_2_6_MODULES |
549 | || ( fd = open ( "/etc/modprobe.conf", O_RDONLY )) < 0 ) | 553 | || ( fd = open ( "/etc/modprobe.conf", O_RDONLY )) < 0 ) |
550 | if (( fd = open ( "/etc/modules.conf", O_RDONLY )) < 0 ) | 554 | if (( fd = open ( "/etc/modules.conf", O_RDONLY )) < 0 ) |
551 | if (( fd = open ( "/etc/conf.modules", O_RDONLY )) < 0 ) | 555 | fd = open ( "/etc/conf.modules", O_RDONLY ); |
552 | return first; | ||
553 | 556 | ||
554 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); | 557 | if (fd >= 0) { |
555 | close(fd); | 558 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); |
559 | close(fd); | ||
560 | } | ||
556 | 561 | ||
557 | filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release); | 562 | /* Only 2.6 has a modules.alias file */ |
558 | fd = open ( filename, O_RDONLY ); | 563 | if (ENABLE_FEATURE_2_6_MODULES) { |
559 | if (ENABLE_FEATURE_CLEAN_UP) | 564 | /* Parse kernel-declared aliases */ |
560 | free(filename); | 565 | filename = bb_xasprintf("/lib/modules/%s/modules.alias", un.release); |
561 | if (fd < 0) { | 566 | if ((fd = open ( filename, O_RDONLY )) < 0) { |
562 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ | 567 | /* Ok, that didn't work. Fall back to looking in /lib/modules */ |
563 | if (( fd = open ( "/lib/modules/modules.alias", O_RDONLY )) < 0 ) { | 568 | fd = open ( "/lib/modules/modules.alias", O_RDONLY ); |
564 | return first; | ||
565 | } | 569 | } |
566 | } | 570 | if (ENABLE_FEATURE_CLEAN_UP) |
571 | free(filename); | ||
567 | 572 | ||
568 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); | 573 | if (fd >= 0) { |
569 | close(fd); | 574 | include_conf (&first, ¤t, buffer, sizeof(buffer), fd); |
575 | close(fd); | ||
576 | } | ||
577 | } | ||
570 | 578 | ||
571 | return first; | 579 | return first; |
572 | } | 580 | } |