From 7158b4b3fc98b65169573aa47f7fabd1370983d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 3 Oct 2018 13:42:08 +0200 Subject: [PATCH] test-fs-util: simplify testdir creation --- src/test/test-fs-util.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index a058ad6..6eb35db 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -615,8 +615,7 @@ static void test_fsync_directory_of_file(void) { } static void test_rename_noreplace(void) { - - const char* const table[] = { + static const char* const table[] = { "/reg", "/dir", "/fifo", @@ -626,16 +625,13 @@ static void test_rename_noreplace(void) { }; _cleanup_(rm_rf_physical_and_freep) char *z = NULL; - const char *e, *j; + const char *e, *j = NULL; char **a, **b; e = getenv("RENAME_NOREPLACE_DIR"); - if (e) { + if (e) j = strjoina(e, "/testXXXXXX"); - - assert_se(mkdtemp_malloc(j, &z) >= 0); - } else - assert_se(mkdtemp_malloc(NULL, &z) >= 0); + assert_se(mkdtemp_malloc(j, &z) >= 0); j = strjoina(z, table[0]); assert_se(touch(j) >= 0); -- 2.7.4