chiark / gitweb /
detect-virt: Fix Xen domU discovery
authorThomas Blume <Thomas.Blume@suse.com>
Thu, 17 Jul 2014 09:25:37 +0000 (11:25 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 17 Jul 2014 12:26:35 +0000 (08:26 -0400)
The conditional for detection xen virtualization contained a little mistake.
It is checking for i to be empty: 'if (!i)  {', but it must check for cap instead,
because: 'cap = strsep(&i, ",")' will set cap to the discovered value and i to
the next value after the separator.
Hence, i would be empty, if there is only control_d in domcap, leading to a wrong
domU detection.

https://bugs.freedesktop.org/show_bug.cgi?id=77271

src/shared/virt.c

index 774915f4be7ddf863c9be0fb9418b67bb8583b45..20a8d7c5bfc4287bdb6bbea0da1aac0a7bf4734a 100644 (file)
@@ -173,7 +173,7 @@ int detect_vm(const char **id) {
                         if (streq(cap, "control_d"))
                                 break;
 
                         if (streq(cap, "control_d"))
                                 break;
 
-                if (!i)  {
+                if (!cap)  {
                         _id = "xen";
                         r = 1;
                 }
                         _id = "xen";
                         r = 1;
                 }