diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-11-16 15:25:02 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-11-16 18:57:57 +0100 |
commit | 8ff5fa167fd83b6db7508c2d9ded84f61515081a (patch) | |
tree | 6913d873327e5ebb139f1c2cb3691135910c968c /src/test/test-install-root.c | |
parent | Merge pull request #21392 from keszybz/memleak-fix-and-assorted-fs-code-cleanups (diff) | |
download | systemd-8ff5fa167fd83b6db7508c2d9ded84f61515081a.tar.xz systemd-8ff5fa167fd83b6db7508c2d9ded84f61515081a.zip |
tree-wide: use WRITE_STRING_FILE_MKDIR_0755 at more places
Diffstat (limited to 'src/test/test-install-root.c')
-rw-r--r-- | src/test/test-install-root.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c index ddba5e4dff..d0bd6917a8 100644 --- a/src/test/test-install-root.c +++ b/src/test/test-install-root.c @@ -710,8 +710,7 @@ static void test_revert(const char *root) { changes = NULL; n_changes = 0; p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); - assert_se(write_string_file(p, "# Empty dropin\n", WRITE_STRING_FILE_CREATE) >= 0); + assert_se(write_string_file(p, "# Empty dropin\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); /* Revert the dropin file */ assert_se(unit_file_revert(UNIT_FILE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); @@ -813,10 +812,9 @@ static void test_with_dropin(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, "/usr/lib/systemd/system/with-dropin-1.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE) >= 0); + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); @@ -826,10 +824,9 @@ static void test_with_dropin(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, "/usr/lib/systemd/system/with-dropin-2.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE) >= 0); + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); @@ -839,10 +836,9 @@ static void test_with_dropin(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-3.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE) >= 0); + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_DISABLED); @@ -852,10 +848,9 @@ static void test_with_dropin(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-4a.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "Also=with-dropin-4b.service\n", WRITE_STRING_FILE_CREATE) >= 0); + "Also=with-dropin-4b.service\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-4a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); @@ -944,10 +939,9 @@ static void test_with_dropin_template(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, "/usr/lib/systemd/system/with-dropin-1@.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE) >= 0); + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-1@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); @@ -957,10 +951,9 @@ static void test_with_dropin_template(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, "/usr/lib/systemd/system/with-dropin-2@instance-1.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE) >= 0); + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-2@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); @@ -971,10 +964,9 @@ static void test_with_dropin_template(const char *root) { "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); p = strjoina(root, "/usr/lib/systemd/system/with-dropin-3@.service.d/dropin.conf"); - assert_se(mkdir_parents(p, 0755) >= 0); assert_se(write_string_file(p, "[Install]\n" - "DefaultInstance=instance-2\n", WRITE_STRING_FILE_CREATE) >= 0); + "DefaultInstance=instance-2\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-3@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); |