From df14e6cc81c296d91e9124cd09f25a83defb522f Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 12 Jun 2026 21:19:25 +0200 Subject: irmd: Fail OAP config load on read errors load_sec_config_file() treated any fopen() failure as an absent config and silently disabled encryption. file_exists() similarly lumped non-ENOENT stat() errors in with "present". Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/irmd/oap/io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/irmd') diff --git a/src/irmd/oap/io.c b/src/irmd/oap/io.c index 5c560ea5..7b661435 100644 --- a/src/irmd/oap/io.c +++ b/src/irmd/oap/io.c @@ -50,11 +50,17 @@ static bool file_exists(const char * path) { struct stat s; - if (stat(path, &s) < 0 && errno == ENOENT) { + if (stat(path, &s) == 0) + return true; + + if (errno == ENOENT) { log_dbg("File %s does not exist.", path); return false; } + /* Can't stat for another reason; assume present, fail on load */ + log_warn("Failed to stat %s: %s.", path, strerror(errno)); + return true; } -- cgit v1.2.3