aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.de.marchi@gmail.com>2012-11-28 14:26:23 -0200
committerLucas De Marchi <lucas.de.marchi@gmail.com>2012-11-28 14:26:23 -0200
commit650f89cd2510820a71dfc1b004634a309f12ecf1 (patch)
tree70560a3b4ed8ad02947a61dfd8ae32686afc7d22
parent5d352563bd3a8d1c6bc07969a5fefe7ddf6bf1c6 (diff)
downloadkmod-650f89cd2510820a71dfc1b004634a309f12ecf1.tar.gz
depmod: fix checking file extension
In depfile_up_to_date_dir() we need to check if name has a kmod extension. "path" variable there will be the directory name, which doesn't contain an extension. Without this, "depmod -A" returns that the modules.dep is up to date, even if it isn't. In depmod_modules_search_file() it's pointless to compare the basename, so pass only the name to be checked.
-rw-r--r--tools/depmod.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/depmod.c b/tools/depmod.c
index de77391..682e662 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -1191,7 +1191,7 @@ static int depmod_modules_search_file(struct depmod *depmod, size_t baselen, siz
size_t modnamelen;
int err;
- if (!path_ends_with_kmod_ext(path, baselen + namelen))
+ if (!path_ends_with_kmod_ext(path + baselen, namelen))
return 0;
if (path_to_modname(path, modname, &modnamelen) == NULL) {
@@ -2387,8 +2387,9 @@ static int depfile_up_to_date_dir(DIR *d, time_t mtime, size_t baselen, char *pa
path);
closedir(subdir);
} else if (S_ISREG(st.st_mode)) {
- if (!path_ends_with_kmod_ext(path, namelen))
+ if (!path_ends_with_kmod_ext(name, namelen))
continue;
+
memcpy(path + baselen, name, namelen + 1);
err = st.st_mtime <= mtime;
if (err == 0) {