From d2c6f9a1f9d5974155f1a7224aecbafba91631a1 Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Wed, 11 Aug 2004 02:32:18 +0000 Subject: Patch from Phil Blundellto improve substring match --- modutils/modprobe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modutils/modprobe.c b/modutils/modprobe.c index fd984e4..ddf63ab 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -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); } -- cgit v1.1