From a3ee0916b14b0a319ee2d8bca283a8c1f17e29ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 19 Oct 2022 09:30:30 +0200 Subject: [PATCH] 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. --- src/resolve/resolved-dns-trust-anchor.c | 2 +- src/test/test-fileio.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/resolve/resolved-dns-trust-anchor.c b/src/resolve/resolved-dns-trust-anchor.c index 9dbe8610705..69a484dc129 100644 --- a/src/resolve/resolved-dns-trust-anchor.c +++ b/src/resolve/resolved-dns-trust-anchor.c @@ -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; diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index 2cc71078032..4f084f6162a 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -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); }