summaryrefslogtreecommitdiff
path: root/src/test/test-copy.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-07-06 19:19:25 -0400
committerDaniel Mack <daniel@zonque.org>2015-07-06 19:19:25 -0400
commit4c1fc3e404d648c70bd2f50ac50aeac6ece8872e (patch)
tree977a223a8f5aa7fc2a5861a8d557b879bfc98a9f /src/test/test-copy.c
parent40beecdb6d1c73e5acb62ebac2ccbfd7891f2418 (diff)
downloadsystemd-4c1fc3e404d648c70bd2f50ac50aeac6ece8872e.tar.gz
fileio: consolidate write_string_file*()
Merge write_string_file(), write_string_file_no_create() and write_string_file_atomic() into write_string_file() and provide a flags mask that allows combinations of atomic writing, newline appending and automatic file creation. Change all users accordingly.
Diffstat (limited to 'src/test/test-copy.c')
-rw-r--r--src/test/test-copy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index b1385b8b87..b73c958ec5 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -43,7 +43,7 @@ static void test_copy_file(void) {
assert_se(fd >= 0);
close(fd);
- assert_se(write_string_file(fn, "foo bar bar bar foo") == 0);
+ 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) == 0);
@@ -67,7 +67,7 @@ static void test_copy_file_fd(void) {
out_fd = mkostemp_safe(out_fn, O_RDWR);
assert_se(out_fd >= 0);
- assert_se(write_string_file(in_fn, text) == 0);
+ assert_se(write_string_file(in_fn, text, WRITE_STRING_FILE_CREATE) == 0);
assert_se(copy_file_fd("/a/file/which/does/not/exist/i/guess", out_fd, true) < 0);
assert_se(copy_file_fd(in_fn, out_fd, true) >= 0);
assert_se(lseek(out_fd, SEEK_SET, 0) == 0);
@@ -94,7 +94,7 @@ static void test_copy_tree(void) {
char *f = strjoina(original_dir, *p);
assert_se(mkdir_parents(f, 0755) >= 0);
- assert_se(write_string_file(f, "file") == 0);
+ assert_se(write_string_file(f, "file", WRITE_STRING_FILE_CREATE) == 0);
}
STRV_FOREACH_PAIR(link, p, links) {