From d70c017cfbbd3f0ad33fbd9498e06eceae295b23 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 31 Oct 2023 10:45:23 +0100 Subject: [PATCH] rec: Fix a warning from Coverity (CID 1522877) --- pdns/recursordist/settings/cxxsupport.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/recursordist/settings/cxxsupport.cc b/pdns/recursordist/settings/cxxsupport.cc index 511305930a..efb328877e 100644 --- a/pdns/recursordist/settings/cxxsupport.cc +++ b/pdns/recursordist/settings/cxxsupport.cc @@ -200,7 +200,10 @@ static void possiblyConvertACLFile(const string& includeDir, const string& apiDi if (rename(tmpfilename.c_str(), yamlfilename.c_str()) != 0) { int err = errno; log->error(Logr::Error, err, "Rename failed", "file", Logging::Loggable(tmpfilename), "to", Logging::Loggable(yamlfilename)); - rename((path + ".converted").c_str(), path.c_str()); + if (rename((path + ".converted").c_str(), path.c_str()) != 0) { + err = errno; + log->error(Logr::Error, err, "Rename failed", "file", Logging::Loggable(path + ".converted"), "to", Logging::Loggable(path)); + } throw runtime_error("YAML Conversion"); } log->info(Logr::Notice, "Converted to YAML", "file", Logging::Loggable(path), "to", Logging::Loggable(yamlfilename)); -- 2.47.2