Patch from Phil Blundellto improve substring match

This commit is contained in:
Glenn L McGrath 2004-08-11 02:32:18 +00:00
parent 65c8c7ba27
commit d2c6f9a1f9

View 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);
}