From f2947bc78e91802e93eee970817b6ca47356225a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 18 Jun 2023 19:04:36 +0200 Subject: [PATCH] specify truncate flag explicitely --- src/fsfw_hal/host/HostFilesystem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsfw_hal/host/HostFilesystem.cpp b/src/fsfw_hal/host/HostFilesystem.cpp index 315ba422..f9f3bdd6 100644 --- a/src/fsfw_hal/host/HostFilesystem.cpp +++ b/src/fsfw_hal/host/HostFilesystem.cpp @@ -165,7 +165,8 @@ ReturnValue_t HostFilesystem::truncateFile(FilesystemParams params) { if (not filesystem::exists(path, e)) { return FILE_DOES_NOT_EXIST; } - ofstream of(path); + // Specify truncaion flug explicitely. + ofstream of(path, std::ios::out | std::ios::trunc); return returnvalue::OK; }