diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-11 10:04:37 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-11 10:19:18 +0100 |
commit | c9a1202ecbcf76fb71b140e23e3c08038b38e846 (patch) | |
tree | f8132d20349562e8c672efcbd0058f62279992cc /src/test/test-copy.c | |
parent | fs-util: Add missing assert to chmod_and_chown_at() (diff) | |
download | systemd-c9a1202ecbcf76fb71b140e23e3c08038b38e846.tar.xz systemd-c9a1202ecbcf76fb71b140e23e3c08038b38e846.zip |
test-copy: Stop using rm_rf_physical_and_close
This cleanup function depends on resolving fd's to paths via /proc
which is unreliable so we shouldn't depend on it for destructive
operations. Use regular path based cleanup instead.
Diffstat (limited to 'src/test/test-copy.c')
-rw-r--r-- | src/test/test-copy.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/test-copy.c b/src/test/test-copy.c index 00a38b18f6..6ad157ef1c 100644 --- a/src/test/test-copy.c +++ b/src/test/test-copy.c @@ -77,11 +77,12 @@ TEST(copy_tree_replace_file) { } TEST(copy_tree_replace_dirs) { - _cleanup_(rm_rf_physical_and_closep) int src = -1, dst = -1; + _cleanup_(rm_rf_physical_and_freep) char *srcp = NULL, *dstp = NULL; + _cleanup_close_ int src = -1, dst = -1; /* Create the random source/destination directories */ - assert_se((src = mkdtemp_open(NULL, 0, NULL)) >= 0); - assert_se((dst = mkdtemp_open(NULL, 0, NULL)) >= 0); + assert_se((src = mkdtemp_open(NULL, 0, &srcp)) >= 0); + assert_se((dst = mkdtemp_open(NULL, 0, &dstp)) >= 0); /* Populate some data to differentiate the files. */ assert_se(write_string_file_at(src, "foo", "src file 1", WRITE_STRING_FILE_CREATE) >= 0); |