]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: make sure we expose the empty string when we detect no virtualization 1426/head
authorLennart Poettering <lennart@poettering.net>
Wed, 30 Sep 2015 20:22:03 +0000 (22:22 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 30 Sep 2015 20:26:17 +0000 (22:26 +0200)
On the bus, stick to exposing the empty string as "no virtualization",
instead of none.

Fixes #1423

src/core/dbus-manager.c

index 561b6f8bfa55efbdfad042b6da3fa51393396c39..1a3a72ae3737ab0372595c0876d3080958d09ddd 100644 (file)
@@ -81,10 +81,21 @@ static int property_get_virtualization(
                 void *userdata,
                 sd_bus_error *error) {
 
+        int v;
+
         assert(bus);
         assert(reply);
 
-        return sd_bus_message_append(reply, "s", virtualization_to_string(detect_virtualization()));
+        v = detect_virtualization();
+
+        /* Make sure to return the empty string when we detect no virtualization, as that is the API.
+         *
+         * https://github.com/systemd/systemd/issues/1423
+         */
+
+        return sd_bus_message_append(
+                        reply, "s",
+                        v == VIRTUALIZATION_NONE ? "" : virtualization_to_string(v));
 }
 
 static int property_get_architecture(