summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/probing.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/probing.c')
-rw-r--r--mdk-stage1/probing.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index 334d0f7b7..fd0f39c50 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -798,26 +798,28 @@ void find_media(enum media_bus bus)
"/proc/array/ida", "/proc/cciss/cciss", // 2.2 style
NULL };
static char cpq_descr[] = "Compaq RAID logical disk";
- char ** procfile = procfiles;
+ char ** procfile;
FILE * f;
- while (procfile && *procfile && (f = fopen(*procfile, "rb"))) {
- while (fgets(buf, sizeof(buf), f)) {
- if (ptr_begins_static_str(buf, "ida/") || ptr_begins_static_str(buf, "cciss/")) {
- char * end = strchr(buf, ':');
- if (!end)
- log_message("Inconsistency in %s, line:\n%s", *procfile, buf);
- else {
- *end = '\0';
- tmp[count].name = strdup(buf);
- tmp[count].type = DISK;
- tmp[count].model = cpq_descr;
- log_message("CPQ: found %s", tmp[count].name);
- count++;
+
+ for (procfile = procfiles; procfile && *procfile; procfile++) {
+ if((f = fopen(*procfile, "rb"))) {
+ while (fgets(buf, sizeof(buf), f)) {
+ if (ptr_begins_static_str(buf, "ida/") || ptr_begins_static_str(buf, "cciss/")) {
+ char * end = strchr(buf, ':');
+ if (!end)
+ log_message("Inconsistency in %s, line:\n%s", *procfile, buf);
+ else {
+ *end = '\0';
+ tmp[count].name = strdup(buf);
+ tmp[count].type = DISK;
+ tmp[count].model = cpq_descr;
+ log_message("CPQ: found %s", tmp[count].name);
+ count++;
+ }
}
}
+ fclose(f);
}
- fclose(f);
- procfile++;
}
}