From 0b3c92888639d40d9371ee4dfe043ffae4140db2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 May 2024 11:11:21 +0200 Subject: [PATCH] combining those is acutally problematic.. --- linux/payload/PlocMpsocSpecialComHelper.cpp | 9 ++++++--- tmtc | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/linux/payload/PlocMpsocSpecialComHelper.cpp b/linux/payload/PlocMpsocSpecialComHelper.cpp index a81f8fd6..0af2c3d5 100644 --- a/linux/payload/PlocMpsocSpecialComHelper.cpp +++ b/linux/payload/PlocMpsocSpecialComHelper.cpp @@ -179,9 +179,12 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() { ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() { std::error_code e; - std::ofstream ofile(flashReadAndWrite.obcFile, - std::ios::trunc | std::ios::binary | std::ios::app); - if (ofile.bad()) { + if (std::filesystem::exists(flashReadAndWrite.obcFile)) { + // Truncate the file first. + std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::binary | std::ios::trunc); + } + std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::binary | std::ios::app); + if (ofile.bad() or not ofile.is_open()) { return returnvalue::FAILED; } ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ); diff --git a/tmtc b/tmtc index dccbf89d..067a0160 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit dccbf89da1e2b441a8fc3edc247550ca5dfbd68b +Subproject commit 067a0160405bcf53659072749eddbb7ad7f1d41c