fireinfo: Fix SEGV on QEMU without KVM

This commit is contained in:
Michael Tremer
2015-05-04 16:02:39 +02:00
parent 11e2e672e8
commit afa91a4df5
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
From c667589410912ca980a78f417e86dd6585d58f9a Mon Sep 17 00:00:00 2001
From: Michael Tremer <michael.tremer@ipfire.org>
Date: Mon, 4 May 2015 16:00:31 +0200
Subject: [PATCH] Skip search for hypervisor name when the CPU string is empty
---
src/_fireinfo/fireinfo.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/_fireinfo/fireinfo.c b/src/_fireinfo/fireinfo.c
index fc639d9d4cd9..6601c21a733f 100644
--- a/src/_fireinfo/fireinfo.c
+++ b/src/_fireinfo/fireinfo.c
@@ -156,11 +156,12 @@ int detect_hypervisor(int *hypervisor) {
*hypervisor = HYPER_OTHER;
- int id;
- for (id = HYPER_NONE + 1; id < HYPER_LAST; id++) {
- if (strcmp(hypervisor_ids[id], sig.text) == 0) {
- *hypervisor = id;
- break;
+ if (*sig.text) {
+ for (int id = HYPER_NONE + 1; id < HYPER_LAST; id++) {
+ if (strcmp(hypervisor_ids[id], sig.text) == 0) {
+ *hypervisor = id;
+ break;
+ }
}
}
--
2.1.0