From d2493703c19437fc4ae3f9c40202e8c4b314d517 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 24 Jan 2023 00:13:23 +0800 Subject: [PATCH 1/2] machinectl: also enable machines.target when enabling machines It's mostly desired to enable machines.target along with the machine since only when both are enabled it would really work. --- src/machine/machinectl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 149b5d8e60..b9e3848d18 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -1616,6 +1616,12 @@ static int enable_machine(int argc, char *argv[], void *userdata) { if (r < 0) return bus_log_create_error(r); + if (streq(argv[0], "enable")) { + r = sd_bus_message_append(m, "s", "machines.target"); + if (r < 0) + return bus_log_create_error(r); + } + for (int i = 1; i < argc; i++) { _cleanup_free_ char *unit = NULL; From e6afd73ba24d3937359cad7ed663ef2e3a442f90 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 24 Jan 2023 00:32:33 +0800 Subject: [PATCH 2/2] machinectl: remove unnecessary initialization --- src/machine/machinectl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index b9e3848d18..a147fae0bd 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -1600,7 +1600,7 @@ static int enable_machine(int argc, char *argv[], void *userdata) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; InstallChange *changes = NULL; size_t n_changes = 0; - const char *method = NULL; + const char *method; sd_bus *bus = ASSERT_PTR(userdata); int r;