]> granicus.if.org Git - icinga2/commitdiff
Add missing _unlink() calls for Windows
authorGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 30 Aug 2017 13:12:04 +0000 (15:12 +0200)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 12 Sep 2017 10:52:49 +0000 (12:52 +0200)
refs #5450

lib/remote/jsonrpcconnection-pki.cpp

index 64cf1c024953c08a8f9c014a3ddb8e1a0e09f6e9..74457065e69d59420e9f3aae1303303da928e2b4 100644 (file)
@@ -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")