Skip to content

Commit

Permalink
import: report error before losing errno
Browse files Browse the repository at this point in the history
unlink() may change errno, so report the error from rename() first, then
unlink.
  • Loading branch information
michich committed Nov 5, 2015
1 parent 4546c34 commit 5cfab27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/import/pull-raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5cfab27

Please sign in to comment.