diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-06-30 21:30:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-30 21:30:35 +0200 |
commit | f15461b2b234c178ecbbc18defaef0032a9b3431 (patch) | |
tree | 81faab6f15ff44393c55484d216fd2e80b993bbf /src/machine/machinectl.c | |
parent | 17c22746b176f2e544d33bdaf30b282ce2c88933 (diff) | |
parent | 1c6c037cece7add31e4017ea7775ddb32d4fe7ec (diff) | |
download | systemd-f15461b2b234c178ecbbc18defaef0032a9b3431.tar.gz |
Merge pull request #3596 from poettering/machine-clean
make "machinectl clean" asynchronous, and open it up via PolicyKit
Diffstat (limited to 'src/machine/machinectl.c')
-rw-r--r-- | src/machine/machinectl.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 843e678eca..161dd3922b 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -2418,7 +2418,7 @@ static int set_limit(int argc, char *argv[], void *userdata) { } static int clean_images(int argc, char *argv[], void *userdata) { - _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; + _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL; _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; uint64_t usage, total = 0; char fb[FORMAT_BYTES_MAX]; @@ -2427,15 +2427,22 @@ static int clean_images(int argc, char *argv[], void *userdata) { unsigned c = 0; int r; - r = sd_bus_call_method( + r = sd_bus_message_new_method_call( bus, + &m, "org.freedesktop.machine1", "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", - "CleanPool", - &error, - &reply, - "s", arg_all ? "all" : "hidden"); + "CleanPool"); + if (r < 0) + return bus_log_create_error(r); + + r = sd_bus_message_append(m, "s", arg_all ? "all" : "hidden"); + if (r < 0) + return bus_log_create_error(r); + + /* This is a slow operation, hence permit a longer time for completion. */ + r = sd_bus_call(bus, m, USEC_INFINITY, &error, &reply); if (r < 0) return log_error_errno(r, "Could not clean pool: %s", bus_error_message(&error, r)); |