summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNir Bar <nir.bar@panel-sw.co.il>2020-05-28 10:41:17 +0300
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-08-11 15:43:39 +0000
commit9429e8b95f587fba1d695e1599bb1ad00c6cde0a (patch)
treed79e95fe105524836101603a8b756f347fba17f4
parent1fe24fa0a441d86155eb619256d79b288c82dd91 (diff)
downloadmongo-9429e8b95f587fba1d695e1599bb1ad00c6cde0a.tar.gz
SERVER-47138 Fix mongod.cfg file size when replacing tokens in the custom action
Closes #1366 Signed-off-by: Andrew Morrow <acm@mongodb.com> (cherry picked from commit c61e18a3c3e18bfa486df3c8ac5a4632a390aa3a) (cherry picked from commit 9d0319b24e374653127f9df97af812885b6adc96) (cherry picked from commit 4346b20b96f5e4c04d4556c02423562177488e18)
-rw-r--r--src/mongo/installer/msi/ca/CustomAction.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/installer/msi/ca/CustomAction.cpp b/src/mongo/installer/msi/ca/CustomAction.cpp
index 771c6553490..aa0d9a10b76 100644
--- a/src/mongo/installer/msi/ca/CustomAction.cpp
+++ b/src/mongo/installer/msi/ca/CustomAction.cpp
@@ -333,6 +333,9 @@ extern "C" UINT __stdcall UpdateMongoYAML(MSIHANDLE hInstall) {
if (!WriteFile(hFile, str.c_str(), str.length(), &written, NULL)) {
CHECKGLE_AND_LOG("Failed to write yaml file");
}
+ if (!SetEndOfFile(hFile)) {
+ CHECKGLE_AND_LOG("Failed to truncate yaml file");
+ }
} catch (const std::exception& e) {
CHECKHR_AND_LOG(E_FAIL, "Caught C++ exception %s", e.what());
} catch (...) {