From febda62a36bea0a817b8bc6e63d71e74f65845ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= Date: Wed, 7 Oct 2015 08:02:31 +0200 Subject: [PATCH] analyze: minor fixes according to review + use _cleanup_host_info in acquire_host_info() + revert the first strempty() to show "Linux" string in case os_pretty_name is missing. --- src/analyze/analyze.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index c2ebdc3443..a76990360a 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -435,7 +435,7 @@ fail: static int acquire_host_info(sd_bus *bus, struct host_info **hi) { int r; - struct host_info *host; + _cleanup_host_info_ struct host_info *host; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; static const struct bus_properties_map hostname_map[] = { @@ -471,13 +471,12 @@ static int acquire_host_info(sd_bus *bus, struct host_info **hi) { "/org/freedesktop/systemd1", manager_map, host); - if (r < 0) { - free_host_info(host); + if (r < 0) return log_error_errno(r, "Failed to get host information from systemd: %s", bus_error_message(&error, r)); - } *hi = host; + host = NULL; return 0; } @@ -658,7 +657,7 @@ static int analyze_plot(sd_bus *bus) { svg("\n"); svg("%s", pretty_times); svg("%s %s (%s %s %s) %s %s", - strempty(host->os_pretty_name), + isempty(host->os_pretty_name) ? "Linux" : host->os_pretty_name, strempty(host->hostname), strempty(host->kernel_name), strempty(host->kernel_release),