From: Remi Gacogne Date: Tue, 31 Oct 2023 09:45:23 +0000 (+0100) Subject: rec: Fix a warning from Coverity (CID 1522877) X-Git-Tag: rec-5.0.0-beta1~22^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13435%2Fhead;p=thirdparty%2Fpdns.git rec: Fix a warning from Coverity (CID 1522877) --- 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));