From: Daan De Meyer Date: Fri, 11 Nov 2022 09:04:37 +0000 (+0100) Subject: test-copy: Stop using rm_rf_physical_and_close X-Git-Tag: v253-rc1~537^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c9a1202ecbcf76fb71b140e23e3c08038b38e846;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/test/test-copy.c b/src/test/test-copy.c index 00a38b18f6a..6ad157ef1c5 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);