From: Lennart Poettering Date: Wed, 30 Sep 2015 20:22:03 +0000 (+0200) Subject: core: make sure we expose the empty string when we detect no virtualization X-Git-Tag: v227~46^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1426%2Fhead;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 561b6f8bfa5..1a3a72ae373 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(