]> git.ipfire.org Git - oddments/fireinfo.git/commitdiff
Skip search for hypervisor name when the CPU string is empty
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 May 2015 14:00:31 +0000 (16:00 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 May 2015 14:00:31 +0000 (16:00 +0200)
src/_fireinfo/fireinfo.c

index fc639d9d4cd904ec03e6a41e71313ce030098fe9..6601c21a733f35a0892d50bd8f95afc128c5973e 100644 (file)
@@ -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;
+                               }
                        }
                }