From: Gunnar Beutner Date: Wed, 30 Aug 2017 13:12:04 +0000 (+0200) Subject: Add missing _unlink() calls for Windows X-Git-Tag: v2.8.0~87^2~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8cc0a601bf2749625aee872f3345351e4db55e5;p=icinga2 Add missing _unlink() calls for Windows refs #5450 --- diff --git a/lib/remote/jsonrpcconnection-pki.cpp b/lib/remote/jsonrpcconnection-pki.cpp index 64cf1c024..74457065e 100644 --- a/lib/remote/jsonrpcconnection-pki.cpp +++ b/lib/remote/jsonrpcconnection-pki.cpp @@ -208,6 +208,10 @@ void JsonRpcConnection::CertificateRequestResponseHandler(const Dictionary::Ptr& cafp << ca; cafp.close(); +#ifdef _WIN32 + _unlink(caPath.CStr()); +#endif /* _WIN32 */ + if (rename(tempCaPath.CStr(), caPath.CStr()) < 0) { BOOST_THROW_EXCEPTION(posix_error() << boost::errinfo_api_function("rename") @@ -222,6 +226,10 @@ void JsonRpcConnection::CertificateRequestResponseHandler(const Dictionary::Ptr& certfp << cert; certfp.close(); +#ifdef _WIN32 + _unlink(certPath.CStr()); +#endif /* _WIN32 */ + if (rename(tempCertPath.CStr(), certPath.CStr()) < 0) { BOOST_THROW_EXCEPTION(posix_error() << boost::errinfo_api_function("rename")