From 5cfab271fe5f60ce211e8755eedb7789a6e150d7 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Thu, 5 Nov 2015 13:44:09 +0100 Subject: import: report error before losing errno unlink() may change errno, so report the error from rename() first, then unlink. --- src/import/pull-raw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c index 4c1787b682..03bfb51756 100644 --- a/src/import/pull-raw.c +++ b/src/import/pull-raw.c @@ -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); -- cgit v1.2.3-54-g00ecf