From 3f189f9278c8d6fcf5aaae14f2e881fef00a2387 Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Tue, 14 Apr 2020 10:29:09 -0700 Subject: [PATCH] target_root: Copy a file instead of tar|tar When we want to install a single file we can copy it instead of using the tar tar dance. tar_tar is still left as a fallback if copy fails Signed-off-by: Otavio Pontes --- src/target_root.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/target_root.c b/src/target_root.c index f720c305..552daf64 100644 --- a/src/target_root.c +++ b/src/target_root.c @@ -278,7 +278,13 @@ static enum swupd_code stage_single_file(struct file *file, struct manifest *mom if (!file->is_config && !file->is_state && !file->use_xattrs && !file->is_link) { ret = link(fullfile_path, staged_file); } + if (ret < 0) { + ret = copy(fullfile_path, staged_file); + } + if (ret < 0) { + // If file failed to link or copy + UNEXPECTED(); ret = install_file_using_tar(fullfile_path, target_path, target_basename); if (ret) { goto out;