X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fimport%2Fpull-tar.c;h=58cafdd7891d93c3710260ae66402ea12117ef65;hb=eef8df097db0bf29c8e42e532e3bc06775a6cad4;hp=de653a88f911db2ca8d4daddbb6e30b4bfe776c3;hpb=dc2c282b6aac820a3c27d8a7a68c0386300db663;p=elogind.git diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c index de653a88f..58cafdd78 100644 --- a/src/import/pull-tar.c +++ b/src/import/pull-tar.c @@ -32,6 +32,7 @@ #include "mkdir.h" #include "path-util.h" #include "import-util.h" +#include "import-common.h" #include "curl-util.h" #include "pull-job.h" #include "pull-common.h" @@ -276,12 +277,13 @@ static void tar_pull_job_on_finished(PullJob *j) { tar_pull_report_progress(i, TAR_FINALIZING); - r = pull_make_read_only(i->temp_path); + r = import_make_read_only(i->temp_path); if (r < 0) goto finish; - if (rename(i->temp_path, i->final_path) < 0) { - r = log_error_errno(errno, "Failed to rename to final image name: %m"); + r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path); + if (r < 0) { + log_error_errno(r, "Failed to rename to final image name: %m"); goto finish; } @@ -334,7 +336,7 @@ static int tar_pull_job_on_open_disk(PullJob *j) { } else if (r < 0) return log_error_errno(errno, "Failed to create subvolume %s: %m", i->temp_path); - j->disk_fd = pull_fork_tar(i->temp_path, &i->tar_pid); + j->disk_fd = import_fork_tar_x(i->temp_path, &i->tar_pid); if (j->disk_fd < 0) return j->disk_fd;