X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-gatewayd.c;h=7e97a3588ce09abbd18befd4f094b05a6bec887e;hb=020d59000f86b3d98be763eaee6a2671f0427e46;hp=093dc74e2c7bc2d3e695d88efa586919beb697eb;hpb=eb9da376d76b48585b3b63b4f91903b54f7abd36;p=elogind.git diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c index 093dc74e2..7e97a3588 100644 --- a/src/journal/journal-gatewayd.c +++ b/src/journal/journal-gatewayd.c @@ -131,6 +131,7 @@ static int respond_oom_internal(struct MHD_Connection *connection) { #define respond_oom(connection) log_oom(), respond_oom_internal(connection) +_printf_(3,4) static int respond_error( struct MHD_Connection *connection, unsigned code, @@ -742,43 +743,31 @@ static int request_handler_file( } static int get_virtualization(char **v) { - _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; _cleanup_bus_unref_ sd_bus *bus = NULL; - const char *t; - char *b; + char *b = NULL; int r; - r = sd_bus_open_system(&bus); + r = sd_bus_default_system(&bus); if (r < 0) return r; - r = sd_bus_call_method( + r = sd_bus_get_property_string( bus, "org.freedesktop.systemd1", "/org/freedesktop/systemd1", - "org.freedesktop.DBus.Properties", - "Get", - NULL, - &reply, - "ss", "org.freedesktop.systemd1.Manager", - "Virtualization"); - if (r < 0) - return r; - - r = sd_bus_message_read(reply, "v", "s", &t); + "Virtualization", + NULL, + &b); if (r < 0) return r; - if (isempty(t)) { + if (isempty(b)) { + free(b); *v = NULL; return 0; } - b = strdup(t); - if (!b) - return -ENOMEM; - *v = b; return 1; } @@ -791,7 +780,7 @@ static int request_handler_machine( RequestMeta *m = connection_cls; int r; _cleanup_free_ char* hostname = NULL, *os_name = NULL; - uint64_t cutoff_from, cutoff_to, usage; + uint64_t cutoff_from = 0, cutoff_to = 0, usage; char *json; sd_id128_t mid, bid; _cleanup_free_ char *v = NULL;