aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/iobuffer.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-10-16 09:49:55 +0200
committerGitHub Enterprise <[email protected]>2024-10-16 09:49:55 +0200
commitb254f75968e1a5692fa872fcfda5eaa1a0ed561d (patch)
tree968e5fc30e37295a4c5767d5c290016116e196ab /src/zencore/iobuffer.cpp
parentupload linux mac exe to sentry (#196) (diff)
downloadzen-b254f75968e1a5692fa872fcfda5eaa1a0ed561d.tar.xz
zen-b254f75968e1a5692fa872fcfda5eaa1a0ed561d.zip
safer path from handle (#195)
* remove PathFromHandle that throws to give better context on failures
Diffstat (limited to 'src/zencore/iobuffer.cpp')
-rw-r--r--src/zencore/iobuffer.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/zencore/iobuffer.cpp b/src/zencore/iobuffer.cpp
index fdee4e5e5..604cd90d6 100644
--- a/src/zencore/iobuffer.cpp
+++ b/src/zencore/iobuffer.cpp
@@ -239,8 +239,18 @@ IoBufferExtendedCore::~IoBufferExtendedCore()
SetFileInformationByHandle(m_FileHandle, FileDispositionInfo, &Fdi, sizeof Fdi);
#else
- std::filesystem::path FilePath = zen::PathFromHandle(m_FileHandle);
- unlink(FilePath.c_str());
+ std::error_code Ec;
+ std::filesystem::path FilePath = zen::PathFromHandle(m_FileHandle, Ec);
+ if (Ec)
+ {
+ ZEN_WARN("Error reported on file handle {}, get path for IoBufferExtendedCore destructor, reason '{}'",
+ m_FileHandle,
+ Ec.message());
+ }
+ else
+ {
+ unlink(FilePath.c_str());
+ }
#endif
}
#if ZEN_PLATFORM_WINDOWS