chiark / gitweb /
networkctl: fix strappend() error checking
[elogind.git] / src / machine / machine.c
index a6d636ea49311d36fa84a89ea23bc3e1ffa3f6f5..b2831187965e4a86e843daa56bfe08cdeec34c63 100644 (file)
 #include "fileio.h"
 #include "special.h"
 #include "unit-name.h"
-#include "machine.h"
 #include "bus-util.h"
 #include "bus-error.h"
+#include "machine.h"
+#include "machine-dbus.h"
 
 Machine* machine_new(Manager *manager, const char *name) {
         Machine *m;
@@ -216,7 +217,7 @@ finish:
                 if (temp_path)
                         unlink(temp_path);
 
-                log_error("Failed to save machine data %s: %s", m->state_file, strerror(-r));
+                log_error_errno(r, "Failed to save machine data %s: %m", m->state_file);
         }
 
         return r;
@@ -259,8 +260,7 @@ int machine_load(Machine *m) {
                 if (r == -ENOENT)
                         return 0;
 
-                log_error("Failed to read %s: %s", m->state_file, strerror(-r));
-                return r;
+                return log_error_errno(r, "Failed to read %s: %m", m->state_file);
         }
 
         if (id)
@@ -406,12 +406,10 @@ static int machine_stop_scope(Machine *m) {
         if (!m->unit)
                 return 0;
 
-        if (!m->registered) {
-                r = manager_stop_unit(m->manager, m->unit, &error, &job);
-                if (r < 0) {
-                        log_error("Failed to stop machine scope: %s", bus_error_message(&error, r));
-                        return r;
-                }
+        r = manager_stop_unit(m->manager, m->unit, &error, &job);
+        if (r < 0) {
+                log_error("Failed to stop machine scope: %s", bus_error_message(&error, r));
+                return r;
         }
 
         free(m->scope_job);