[Crash-utility] [PATCH] fix for '/proc/version' check
Michael Holzheu
holzheu at de.ibm.com
Thu Sep 14 07:31:00 UTC 2006
Hi Dave!
It can happen that crash does not extract the correct Linux version string
from vmlinux. Therefore the comparison with /proc/version fails at startup:
WARNING: /usr/lib/debug/lib/modules/2.6.17-1.2519.4.21.el5/vmlinux
and /proc/version do not match!
Crash gets the release string by searching strings in vmlinux. Something
like:
>> strings vmlinux | grep "Linux version"
>`0Linux version 2.6.17-1.2519.4.21.el5 ...
On our system the string does not start with "Linux...", but with "0Linux...".
Therefore crash assumes a wrong version string. To fix this, we should skip the
leading "0":
---
diff o-Naur crash-4.0-3.3/filesys.c crash-4.0-3.3-proc-version-check-fix/filesys.c
--- crash-4.0-3.3/filesys.c 2006-09-07 21:00:08.000000000 +0200
+++ crash-4.0-3.3-proc-version-check-fix/filesys.c 2006-09-13 15:36:54.000000000 +0200
@@ -244,10 +244,12 @@
found = FALSE;
while (fgets(buffer, BUFSIZE-1, pipe)) {
- if (!strstr(buffer, "Linux version 2."))
+ char* ptr;
+ ptr = strstr(buffer, "Linux version 2.");
+ if (!ptr)
continue;
- if (STREQ(buffer, kt->proc_version))
+ if (STREQ(ptr, kt->proc_version))
found = TRUE;
break;
}
More information about the Crash-utility
mailing list