summaryrefslogtreecommitdiff
path: root/src/import/export-raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/import/export-raw.c')
-rw-r--r--src/import/export-raw.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/import/export-raw.c b/src/import/export-raw.c
index f97ae461c5..6a02b47a17 100644
--- a/src/import/export-raw.c
+++ b/src/import/export-raw.c
@@ -15,12 +15,13 @@
#include "copy.h"
#include "export-raw.h"
#include "fd-util.h"
-#include "fileio.h"
+#include "fs-util.h"
#include "import-common.h"
#include "missing.h"
#include "ratelimit.h"
#include "stat-util.h"
#include "string-util.h"
+#include "tmpfile-util.h"
#include "util.h"
#define COPY_BUFFER_SIZE (16*1024)
@@ -85,16 +86,19 @@ int raw_export_new(
assert(ret);
- e = new0(RawExport, 1);
+ e = new(RawExport, 1);
if (!e)
return -ENOMEM;
- e->output_fd = e->input_fd = -1;
- e->on_finished = on_finished;
- e->userdata = userdata;
+ *e = (RawExport) {
+ .output_fd = -1,
+ .input_fd = -1,
+ .on_finished = on_finished,
+ .userdata = userdata,
+ .last_percent = (unsigned) -1,
+ };
RATELIMIT_INIT(e->progress_rate_limit, 100 * USEC_PER_MSEC, 1);
- e->last_percent = (unsigned) -1;
if (event)
e->event = sd_event_ref(event);
@@ -244,13 +248,9 @@ static int raw_export_on_defer(sd_event_source *s, void *userdata) {
}
static int reflink_snapshot(int fd, const char *path) {
- char *p, *d;
int new_fd, r;
- p = strdupa(path);
- d = dirname(p);
-
- new_fd = open(d, O_TMPFILE|O_CLOEXEC|O_NOCTTY|O_RDWR, 0600);
+ new_fd = open_parent(path, O_TMPFILE|O_CLOEXEC|O_RDWR, 0600);
if (new_fd < 0) {
_cleanup_free_ char *t = NULL;