diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-03-28 17:54:04 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-03-28 18:43:04 +0100 |
commit | 8a016c746ef4f7e9b5fcc5fc7086e80880d84608 (patch) | |
tree | 3de74a91ac4963ec214009b55c14fd72b1429712 /src/test/test-copy.c | |
parent | c3272fd4df4a2ff3ebc1b8d4024d56bc803a1b62 (diff) | |
download | systemd-8a016c746ef4f7e9b5fcc5fc7086e80880d84608.tar.gz |
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.
Diffstat (limited to 'src/test/test-copy.c')
-rw-r--r-- | src/test/test-copy.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-copy.c b/src/test/test-copy.c index b17a1c53fe..5f4bc39580 100644 --- a/src/test/test-copy.c +++ b/src/test/test-copy.c @@ -38,7 +38,7 @@ static void test_copy_file(void) { assert_se(write_string_file(fn, "foo bar bar bar foo", WRITE_STRING_FILE_CREATE) == 0); - assert_se(copy_file(fn, fn_copy, 0, 0644, 0, COPY_REFLINK) == 0); + assert_se(copy_file(fn, fn_copy, 0, 0644, 0, 0, COPY_REFLINK) == 0); assert_se(read_full_file(fn_copy, &buf, &sz) == 0); assert_se(streq(buf, "foo bar bar bar foo\n")); @@ -246,13 +246,13 @@ static void test_copy_atomic(void) { q = strjoina(p, "/fstab"); - r = copy_file_atomic("/etc/fstab", q, 0644, 0, COPY_REFLINK); + r = copy_file_atomic("/etc/fstab", q, 0644, 0, 0, COPY_REFLINK); if (r == -ENOENT) return; - assert_se(copy_file_atomic("/etc/fstab", q, 0644, 0, COPY_REFLINK) == -EEXIST); + assert_se(copy_file_atomic("/etc/fstab", q, 0644, 0, 0, COPY_REFLINK) == -EEXIST); - assert_se(copy_file_atomic("/etc/fstab", q, 0644, 0, COPY_REPLACE) >= 0); + assert_se(copy_file_atomic("/etc/fstab", q, 0644, 0, 0, COPY_REPLACE) >= 0); } int main(int argc, char *argv[]) { |