From fcb00292a5827a0b5e8a83e6cb8f1ed541796b4d Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 27 Jul 2021 22:04:46 +0200 Subject: [PATCH] fix: More invalid use of file io functions on Unix --- source/providers/file_provider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/providers/file_provider.cpp b/source/providers/file_provider.cpp index cd026d899..433b3e8eb 100644 --- a/source/providers/file_provider.cpp +++ b/source/providers/file_provider.cpp @@ -106,7 +106,7 @@ namespace hex::prv { #else auto handle = ::open(this->m_path.data(), 0644); - truncate(handle, newSize - 1); + ftruncate(handle, newSize - 1); close(handle); #endif @@ -196,7 +196,7 @@ namespace hex::prv { ProjectFile::setFilePath(this->m_path); #else - this->m_file = ::open(path.data(), O_RDWR); + this->m_file = ::open(this->m_path.data(), O_RDWR); if (this->m_file == -1) { this->m_file = ::open(path.data(), O_RDONLY); this->m_writable = false;