util-linux-ng/util-linux-ng-2.16-libblkid-compression.patch

57 lines
1.4 KiB
Diff

From e94e99523d8a3d0218fe16b0a7a2c5886ccbc652 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Sun, 23 Aug 2009 20:33:10 +0200
Subject: [PATCH] libblkid: add *.ko.gz support to modules.dep parser
Address-Red-Hat-Bug: #518572
Signed-off-by: Karel Zak <kzak@redhat.com>
---
shlibs/blkid/src/probers/ext.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/shlibs/blkid/src/probers/ext.c b/shlibs/blkid/src/probers/ext.c
index a4d35d1..c27411d 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;
}
--
1.6.2.5