Patch from Phil Blundellto improve substring match
authorGlenn L McGrath <bug1@ihug.co.nz>
Wed, 11 Aug 2004 02:32:18 +0000 (02:32 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Wed, 11 Aug 2004 02:32:18 +0000 (02:32 -0000)
modutils/modprobe.c

index fd984e446213a9988edb8c97db76091fbc083820..ddf63ab7042f6669ce7125540a55bd63f18d4b99 100644 (file)
@@ -370,9 +370,12 @@ static int mod_strcmp ( const char *mod_path, const char *mod_name )
                mod_ext = ".ko";
 #endif
 
-       return (strncmp(last_comp ? last_comp + 1 : mod_path,
+       last_comp = last_comp ? last_comp + 1 : mod_path;
+
+       return (strncmp(last_comp,
                                         mod_name,
                                         strlen(mod_name)) == 0 ) &&
+                  ((strcmp(last_comp + strlen (mod_name), mod_ext) == 0) || last_comp[strlen(mod_name)] == 0) &&
                   (strcmp(mod_path + strlen(mod_path) -
                                        strlen(mod_ext), mod_ext) == 0);
 }