From: Yu Watanabe Date: Mon, 11 Mar 2019 03:51:51 +0000 (+0900) Subject: machinectl: do not format size if freed disk space is "-1" X-Git-Tag: v242-rc1~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a6797f19ffd4194e8d17b52bcfd787fe061a3b6;p=thirdparty%2Fsystemd.git machinectl: do not format size if freed disk space is "-1" Closes #11941. --- diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 30f2e26a1e8..8b97b4d8cef 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -2666,10 +2666,15 @@ static int clean_images(int argc, char *argv[], void *userdata) { return bus_log_parse_error(r); while ((r = sd_bus_message_read(reply, "(st)", &name, &usage)) > 0) { - log_info("Removed image '%s'. Freed exclusive disk space: %s", - name, format_bytes(fb, sizeof(fb), usage)); - - total += usage; + if (usage == UINT64_MAX) { + log_info("Removed image '%s'", name); + total = UINT64_MAX; + } else { + log_info("Removed image '%s'. Freed exclusive disk space: %s", + name, format_bytes(fb, sizeof(fb), usage)); + if (total != UINT64_MAX) + total += usage; + } c++; } @@ -2677,8 +2682,11 @@ static int clean_images(int argc, char *argv[], void *userdata) { if (r < 0) return bus_log_parse_error(r); - log_info("Removed %u images in total. Total freed exclusive disk space %s.", - c, format_bytes(fb, sizeof(fb), total)); + if (total == UINT64_MAX) + log_info("Removed %u images in total.", c); + else + log_info("Removed %u images in total. Total freed exclusive disk space: %s.", + c, format_bytes(fb, sizeof(fb), total)); return 0; }