From: Karel Zak Date: Sun, 23 Aug 2009 18:33:10 +0000 (+0200) Subject: libblkid: add *.ko.gz support to modules.dep parser X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80a1e41be192c55467e7e794a25d5fcc0d270326;p=util-linux libblkid: add *.ko.gz support to modules.dep parser Address-Red-Hat-Bug: #518572 Signed-off-by: Karel Zak --- diff --git a/shlibs/blkid/src/probers/ext.c b/shlibs/blkid/src/probers/ext.c index a4d35d12..c27411d2 100644 --- a/shlibs/blkid/src/probers/ext.c +++ b/shlibs/blkid/src/probers/ext.c @@ -224,8 +224,8 @@ static int check_for_modules(const char *fs_name) #ifdef __linux__ struct utsname uts; FILE *f; - char buf[1024], *cp, *t; - int i; + char buf[1024], *cp; + int namesz; if (uname(&uts)) return 0; @@ -234,6 +234,9 @@ static int check_for_modules(const char *fs_name) f = fopen(buf, "r"); if (!f) return 0; + + namesz = strlen(fs_name); + while (!feof(f)) { if (!fgets(buf, sizeof(buf), f)) break; @@ -244,13 +247,10 @@ static int check_for_modules(const char *fs_name) if ((cp = strrchr(buf, '/')) == NULL) continue; cp++; - i = strlen(cp); - if (i > 3) { - t = cp + i - 3; - if (!strcmp(t, ".ko")) - *t = 0; - } - if (!strcmp(cp, fs_name)) { + + if (!strncmp(cp, fs_name, namesz) && + (!strcmp(cp + namesz, ".ko") || + !strcmp(cp + namesz, ".ko.gz"))) { fclose(f); return 1; }