From 718d07fe5ed14424ed88195c91c4d52fbcc84065 Mon Sep 17 00:00:00 2001 From: Benjamin Bihler Date: Thu, 11 Jul 2019 11:16:12 +0200 Subject: [PATCH] 0030403: Application Framework - Overwriting Big BinOcaf Files Does Not Reduce Their Size OSD_OpenFileDescriptor(), added truncating flag to fopen() flags for std::ios_base::out, since truncating is implied by C++ output flag. This fixes misbehavior of OSD_OpenStream() on MinGW-w64 platform. --- src/OSD/OSD_OpenFile.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/OSD/OSD_OpenFile.cxx b/src/OSD/OSD_OpenFile.cxx index ba8db4b724..72b54b08ea 100644 --- a/src/OSD/OSD_OpenFile.cxx +++ b/src/OSD/OSD_OpenFile.cxx @@ -34,14 +34,12 @@ static int OSD_OpenFile_iosMode2FileFlags (::std::ios_base::openmode theMode) { aFlags |= O_WRONLY; aFlags |= O_CREAT; + aFlags |= O_TRUNC; + if (theMode & ::std::ios_base::app) { aFlags |= O_APPEND; } - if (theMode & ::std::ios_base::trunc) - { - aFlags |= O_TRUNC; - } } #ifdef _WIN32 if (theMode & ::std::ios_base::binary) -- 2.39.5