1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

resolved,test-fileio: use "re" when opening files

This doesn't matter too much, because neither of those programs forks, but
let's dot he generally correct thing anyway.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-10-19 09:30:30 +02:00
parent 9ca1efbc46
commit a3ee0916b1
2 changed files with 7 additions and 7 deletions

View File

@ -423,7 +423,7 @@ static int dns_trust_anchor_load_files(
_cleanup_fclose_ FILE *g = NULL;
unsigned n = 0;
g = fopen(*f, "r");
g = fopen(*f, "re");
if (!g) {
if (errno == ENOENT)
continue;

View File

@ -554,15 +554,15 @@ TEST(search_and_fopen) {
f = safe_fclose(f);
p = mfree(p);
r = search_and_fopen("/a/file/which/does/not/exist/i/guess", "r", NULL, (const char**) dirs, &f, &p);
r = search_and_fopen("/a/file/which/does/not/exist/i/guess", "re", NULL, (const char**) dirs, &f, &p);
assert_se(r == -ENOENT);
r = search_and_fopen("afilewhichdoesnotexistiguess", "r", NULL, (const char**) dirs, &f, &p);
r = search_and_fopen("afilewhichdoesnotexistiguess", "re", NULL, (const char**) dirs, &f, &p);
assert_se(r == -ENOENT);
r = unlink(name);
assert_se(r == 0);
r = search_and_fopen(basename(name), "r", NULL, (const char**) dirs, &f, &p);
r = search_and_fopen(basename(name), "re", NULL, (const char**) dirs, &f, &p);
assert_se(r == -ENOENT);
}
@ -595,15 +595,15 @@ TEST(search_and_fopen_nulstr) {
f = safe_fclose(f);
p = mfree(p);
r = search_and_fopen_nulstr("/a/file/which/does/not/exist/i/guess", "r", NULL, dirs, &f, &p);
r = search_and_fopen_nulstr("/a/file/which/does/not/exist/i/guess", "re", NULL, dirs, &f, &p);
assert_se(r == -ENOENT);
r = search_and_fopen_nulstr("afilewhichdoesnotexistiguess", "r", NULL, dirs, &f, &p);
r = search_and_fopen_nulstr("afilewhichdoesnotexistiguess", "re", NULL, dirs, &f, &p);
assert_se(r == -ENOENT);
r = unlink(name);
assert_se(r == 0);
r = search_and_fopen_nulstr(basename(name), "r", NULL, dirs, &f, &p);
r = search_and_fopen_nulstr(basename(name), "re", NULL, dirs, &f, &p);
assert_se(r == -ENOENT);
}