]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/machine/machined.c
Rename formats-util.h to format-util.h
[thirdparty/systemd.git] / src / machine / machined.c
index fe229c88a8c8f039a51b53b61628952336c86e0f..8719e01de92d3cf979a3ed2a2bffc3e230b06a3c 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 /***
   This file is part of systemd.
 
 
 #include "sd-daemon.h"
 
+#include "alloc-util.h"
 #include "bus-error.h"
 #include "bus-util.h"
 #include "cgroup-util.h"
+#include "dirent-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "hostname-util.h"
 #include "label.h"
 #include "machine-image.h"
@@ -70,6 +70,11 @@ void manager_free(Manager *m) {
 
         assert(m);
 
+        while (m->operations)
+                operation_free(m->operations);
+
+        assert(m->n_operations == 0);
+
         while ((machine = hashmap_first(m->machines)))
                 machine_free(machine);
 
@@ -148,8 +153,7 @@ int manager_enumerate_machines(Manager *m) {
                 if (errno == ENOENT)
                         return 0;
 
-                log_error_errno(errno, "Failed to open /run/systemd/machines: %m");
-                return -errno;
+                return log_error_errno(errno, "Failed to open /run/systemd/machines: %m");
         }
 
         FOREACH_DIRENT(de, d, return -errno) {
@@ -183,7 +187,7 @@ int manager_enumerate_machines(Manager *m) {
 }
 
 static int manager_connect_bus(Manager *m) {
-        _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+        _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
         int r;
 
         assert(m);
@@ -299,7 +303,7 @@ void manager_gc(Manager *m, bool drop_not_started) {
                     machine_get_state(machine) != MACHINE_CLOSING)
                         machine_stop(machine);
 
-                /* Now, the stop stop probably made this referenced
+                /* Now, the stop probably made this referenced
                  * again, but if it didn't, then it's time to let it
                  * go entirely. */
                 if (!machine_check_gc(machine, drop_not_started)) {
@@ -337,6 +341,9 @@ int manager_startup(Manager *m) {
 static bool check_idle(void *userdata) {
         Manager *m = userdata;
 
+        if (m->operations)
+                return false;
+
         manager_gc(m, true);
 
         return hashmap_isempty(m->machines);