util-lib: when copying files make sure to apply some chattrs early, some late

Some chattrs only work sensible if you set them right after opening a
file for create (think: FS_NOCOW_FL). Others only work when they are
applied when the file is fully written (think: FS_IMMUTABLE_FL). Let's
take that into account when copying files and applying a chattr to them.
This commit is contained in:
Lennart Poettering
2019-03-28 18:43:04 +01:00
parent c3272fd4df
commit 8a016c746e
11 changed files with 47 additions and 25 deletions
+1 -1
View File
@@ -7210,7 +7210,7 @@ static int create_edit_temp_file(const char *new_path, const char *original_path
if (r < 0)
return log_error_errno(r, "Failed to create directories for \"%s\": %m", new_path);
r = copy_file(original_path, t, 0, 0644, 0, COPY_REFLINK);
r = copy_file(original_path, t, 0, 0644, 0, 0, COPY_REFLINK);
if (r == -ENOENT) {
r = touch(t);