summaryrefslogtreecommitdiff
path: root/src/core/dbus-manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-30 22:22:03 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-30 22:26:17 +0200
commit5c22925a5713ad6f62d89ef478b82e571e9ba688 (patch)
tree3d746b6ed7365587ae5b7b90cfc23af31473b1db /src/core/dbus-manager.c
parente53fc357a9bb9d0a5362ccc4246d598cb0febd5e (diff)
core: make sure we expose the empty string when we detect no virtualization
On the bus, stick to exposing the empty string as "no virtualization", instead of none. Fixes #1423
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r--src/core/dbus-manager.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 561b6f8bfa..1a3a72ae37 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -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(