]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
import: report error before losing errno
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 5 Nov 2015 12:44:09 +0000 (13:44 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 5 Nov 2015 12:44:09 +0000 (13:44 +0100)
unlink() may change errno, so report the error from rename() first, then
unlink.

src/import/pull-raw.c

index 4c1787b6821ee3241d51d44d81545a31dd886bab..03bfb5175699c1af36c26d16fc69496b5a1f6bb9 100644 (file)
@@ -335,8 +335,9 @@ static int raw_pull_make_local_copy(RawPull *i) {
 
         r = rename(tp, p);
         if (r < 0)  {
+                r = log_error_errno(errno, "Failed to move writable image into place: %m");
                 unlink(tp);
-                return log_error_errno(errno, "Failed to move writable image into place: %m");
+                return r;
         }
 
         log_info("Created new local image '%s'.", i->local);