aboutsummaryrefslogtreecommitdiff
path: root/modutils/modprobe.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-07-20 17:36:18 +0000
committerRob Landley <rob@landley.net>2006-07-20 17:36:18 +0000
commitbf30c69a38a38561b4165549478a14efdbb95a53 (patch)
tree6d69dc49042d622e2a1b9b7ea70576d9853b004d /modutils/modprobe.c
parentf86a5ba510ef62ab46d14bd0761a1d88289a398d (diff)
downloadbusybox-w32-bf30c69a38a38561b4165549478a14efdbb95a53.tar.gz
busybox-w32-bf30c69a38a38561b4165549478a14efdbb95a53.tar.bz2
busybox-w32-bf30c69a38a38561b4165549478a14efdbb95a53.zip
Patch from Yann Morin to fix bug 941, underscores in module aliases.
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r--modutils/modprobe.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index a04377180..b11e58d55 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -713,6 +713,37 @@ static int mod_process ( struct mod_list_t *list, int do_insert )
713} 713}
714 714
715/* 715/*
716 * Check the matching between a pattern and a module name.
717 * We need this as *_* is equivalent to *-*, even in pattern matching.
718 */
719static int check_pattern( const char* pat_src, const char* mod_src ) {
720 int ret;
721
722 if (ENABLE_FEATURE_MODPROBE_FANCY_ALIAS) {
723 char* pat;
724 char* mod;
725 char* p;
726
727 pat = bb_xstrdup (pat_src);
728 mod = bb_xstrdup (mod_src);
729
730 for (p = pat; (p = strchr(p, '-')); *p++ = '_' );
731 for (p = mod; (p = strchr(p, '-')); *p++ = '_' );
732
733 ret = fnmatch ( pat, mod, 0 );
734
735 if (ENABLE_FEATURE_CLEAN_UP) {
736 free (pat);
737 free (mod);
738 }
739
740 return ret;
741 } else {
742 return fnmatch ( pat_src, mod_src, 0 );
743 }
744}
745
746/*
716 * Builds the dependency list (aka stack) of a module. 747 * Builds the dependency list (aka stack) of a module.
717 * head: the highest module in the stack (last to insmod, first to rmmod) 748 * head: the highest module in the stack (last to insmod, first to rmmod)
718 * tail: the lowest module in the stack (first to insmod, last to rmmod) 749 * tail: the lowest module in the stack (first to insmod, last to rmmod)
@@ -730,7 +761,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t *
730 * Of course if the name in the dependency rule is a plain string, 761 * Of course if the name in the dependency rule is a plain string,
731 * then we consider it a pattern, and matching will still work. */ 762 * then we consider it a pattern, and matching will still work. */
732 for ( dt = depend; dt; dt = dt-> m_next ) { 763 for ( dt = depend; dt; dt = dt-> m_next ) {
733 if ( fnmatch ( dt-> m_name, mod, 0 ) == 0) { 764 if ( check_pattern ( dt-> m_name, mod ) == 0) {
734 break; 765 break;
735 } 766 }
736 } 767 }
@@ -746,7 +777,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t *
746 struct dep_t *adt; 777 struct dep_t *adt;
747 778
748 for ( adt = depend; adt; adt = adt-> m_next ) { 779 for ( adt = depend; adt; adt = adt-> m_next ) {
749 if ( strcmp ( adt-> m_name, dt-> m_deparr [0] ) == 0 ) 780 if ( check_pattern ( adt-> m_name, dt-> m_deparr [0] ) == 0 )
750 break; 781 break;
751 } 782 }
752 if ( adt ) { 783 if ( adt ) {