chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
importd: add new bus calls for importing local tar and raw images
[elogind.git]
/
src
/
import
/
pull-raw.c
diff --git
a/src/import/pull-raw.c
b/src/import/pull-raw.c
index 4029c7ed17e73fd23542943ed7a3ec2534a95b60..d1d77d598bc7111946624db25de61ecda1a365b7 100644
(file)
--- a/
src/import/pull-raw.c
+++ b/
src/import/pull-raw.c
@@
-33,6
+33,7
@@
#include "mkdir.h"
#include "path-util.h"
#include "import-util.h"
#include "mkdir.h"
#include "path-util.h"
#include "import-util.h"
+#include "import-common.h"
#include "curl-util.h"
#include "qcow2-util.h"
#include "pull-job.h"
#include "curl-util.h"
#include "qcow2-util.h"
#include "pull-job.h"
@@
-210,7
+211,7
@@
static int raw_pull_maybe_convert_qcow2(RawPull *i) {
if (r < 0)
return log_oom();
if (r < 0)
return log_oom();
- converted_fd = open(t, O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_CLOEXEC, 06
4
4);
+ converted_fd = open(t, O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_CLOEXEC, 06
6
4);
if (converted_fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", t);
if (converted_fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", t);
@@
-226,9
+227,8
@@
static int raw_pull_maybe_convert_qcow2(RawPull *i) {
return log_error_errno(r, "Failed to convert qcow2 image: %m");
}
return log_error_errno(r, "Failed to convert qcow2 image: %m");
}
- unlink(i->temp_path);
+
(void)
unlink(i->temp_path);
free(i->temp_path);
free(i->temp_path);
-
i->temp_path = t;
t = NULL;
i->temp_path = t;
t = NULL;
@@
-380,11
+380,11
@@
static void raw_pull_job_on_finished(PullJob *j) {
raw_pull_report_progress(i, RAW_FINALIZING);
raw_pull_report_progress(i, RAW_FINALIZING);
- r =
pull
_make_read_only_fd(i->raw_job->disk_fd);
+ r =
import
_make_read_only_fd(i->raw_job->disk_fd);
if (r < 0)
goto finish;
if (r < 0)
goto finish;
- r = rename
(i->temp_path, i->final_path
);
+ r = rename
at2(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path, RENAME_NOREPLACE
);
if (r < 0) {
r = log_error_errno(errno, "Failed to move RAW file into place: %m");
goto finish;
if (r < 0) {
r = log_error_errno(errno, "Failed to move RAW file into place: %m");
goto finish;
@@
-426,12
+426,12
@@
static int raw_pull_job_on_open_disk(PullJob *j) {
return log_oom();
r = tempfn_random(i->final_path, &i->temp_path);
return log_oom();
r = tempfn_random(i->final_path, &i->temp_path);
- if (r <0)
+ if (r <
0)
return log_oom();
return log_oom();
- mkdir_parents_label(i->temp_path, 0700);
+
(void)
mkdir_parents_label(i->temp_path, 0700);
- j->disk_fd = open(i->temp_path, O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_CLOEXEC, 06
4
4);
+ j->disk_fd = open(i->temp_path, O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_CLOEXEC, 06
6
4);
if (j->disk_fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", i->temp_path);
if (j->disk_fd < 0)
return log_error_errno(errno, "Failed to create %s: %m", i->temp_path);