aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/crashinfo
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2017-07-19 18:41:16 +0000
committerMark Johnston <markj@FreeBSD.org>2017-07-19 18:41:16 +0000
commit5a3924b985ea75da767d7cb805c804c5dac74b59 (patch)
tree0992b7197b8bcec90643720c0aec82da5147f333 /usr.sbin/crashinfo
parent274b460b606f7a16841eba3b7dfbfc4992ee6eb0 (diff)
downloadsrc-5a3924b985ea75da767d7cb805c804c5dac74b59.tar.gz
src-5a3924b985ea75da767d7cb805c804c5dac74b59.zip
Notes
Diffstat (limited to 'usr.sbin/crashinfo')
-rwxr-xr-xusr.sbin/crashinfo/crashinfo.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/crashinfo/crashinfo.sh b/usr.sbin/crashinfo/crashinfo.sh
index e52c01419b0d..2d0b53bcc339 100755
--- a/usr.sbin/crashinfo/crashinfo.sh
+++ b/usr.sbin/crashinfo/crashinfo.sh
@@ -83,10 +83,12 @@ find_kernel()
}
}' $INFO)
- # Look for a matching kernel version.
+ # Look for a matching kernel version, handling possible truncation
+ # of the version string recovered from the dump.
for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do
- kvers=$(gdb_command $k 'printf " Version String: %s", version' \
- 2>/dev/null)
+ kvers=$(gdb_command $k 'printf " Version String: %s", version' | \
+ awk "{line=line\$0\"\n\"} END{print substr(line,1,${#ivers})}" \
+ 2>/dev/null)
if [ "$ivers" = "$kvers" ]; then
KERNEL=$k
break