From aa4bfa8d88152fda322782e5bc8d9d0c714fcc9d Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 5 Mar 2024 14:09:40 +0100 Subject: [PATCH] we might want an OK --- bsp_q7s/core/CoreController.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 77e499b1..a60f4fd7 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -2114,13 +2114,17 @@ ReturnValue_t CoreController::initLeapSecondsFromFile() { ReturnValue_t CoreController::writeLeapSecondsToFile(const uint16_t leapSeconds) { std::string fileName = currMntPrefix + LEAP_SECONDS_FILE; - if (sdcMan->isSdCardUsable(std::nullopt)) { - std::ofstream leapSecondsFile(fileName.c_str(), std::ofstream::out | std::ofstream::trunc); - if (leapSecondsFile.is_open()) { - leapSecondsFile << "LEAP SECONDS: " << leapSeconds << std::endl; - } + if (not sdcMan->isSdCardUsable(std::nullopt)) { + return returnvalue::FAILED; } - return returnvalue::FAILED; + std::ofstream leapSecondsFile(fileName.c_str(), std::ofstream::out | std::ofstream::trunc); + if (not leapSecondsFile.good()) { + sif::error << "CoreController::leapSecondsFileHandler: Error opening time file: " + << strerror(errno) << std::endl; + return returnvalue::FAILED; + } + leapSecondsFile << "LEAP SECONDS: " << leapSeconds << std::endl; + return returnvalue::OK; }; ReturnValue_t CoreController::actionUpdateLeapSeconds(const uint8_t *data) {