diff options
| author | Dan Engelbrecht <[email protected]> | 2024-10-16 09:49:55 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-10-16 09:49:55 +0200 |
| commit | b254f75968e1a5692fa872fcfda5eaa1a0ed561d (patch) | |
| tree | 968e5fc30e37295a4c5767d5c290016116e196ab /src/zenhttp/httpclient.cpp | |
| parent | upload linux mac exe to sentry (#196) (diff) | |
| download | zen-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/zenhttp/httpclient.cpp')
| -rw-r--r-- | src/zenhttp/httpclient.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/zenhttp/httpclient.cpp b/src/zenhttp/httpclient.cpp index 7ac0028cc..0d12cf815 100644 --- a/src/zenhttp/httpclient.cpp +++ b/src/zenhttp/httpclient.cpp @@ -367,8 +367,18 @@ public: SetFileInformationByHandle(m_FileHandle, FileDispositionInfo, &Fdi, sizeof Fdi); BOOL Success = CloseHandle(m_FileHandle); #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 get file path from handle {} for temp payload unlink operation, reason '{}'", + m_FileHandle, + Ec.message()); + } + else + { + unlink(FilePath.c_str()); + } int Fd = int(uintptr_t(m_FileHandle)); bool Success = (close(Fd) == 0); #endif |