-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
free(i->final_path);
free(i->image_root);
free(i->local);
- free(i);
-
- return NULL;
+ return mfree(i);
}
int tar_import_new(
return r;
}
- *ret = i;
- i = NULL;
+ *ret = TAKE_PTR(i);
return 0;
}
i->tar_fd = safe_close(i->tar_fd);
if (i->tar_pid > 0) {
- r = wait_for_terminate_and_warn("tar", i->tar_pid, true);
+ r = wait_for_terminate_and_check("tar", i->tar_pid, WAIT_LOG);
i->tar_pid = 0;
if (r < 0)
return r;
assert(!i->temp_path);
assert(i->tar_fd < 0);
- i->final_path = strjoin(i->image_root, "/", i->local, NULL);
+ i->final_path = strjoin(i->image_root, "/", i->local);
if (!i->final_path)
return log_oom();
}
if (l == 0) {
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
- log_error("Premature end of file: %m");
+ log_error("Premature end of file.");
r = -EIO;
goto finish;
}
if (i->compress.type == IMPORT_COMPRESS_UNKNOWN) {
r = import_uncompress_detect(&i->compress, i->buffer, i->buffer_size);
if (r < 0) {
- log_error("Failed to detect file compression: %m");
+ log_error_errno(r, "Failed to detect file compression: %m");
goto finish;
}
if (r == 0) /* Need more data */