1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-01-15 09:17:57 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Gabi Melman
d67efb2cab
Merge pull request #1296 from sylveon/patch-1
Correctly guard SetHandleInformation API call
2019-11-04 10:58:14 +02:00
Charles Milette
0e09ecbaa5
Correctly guard SetHandleInformation API call
`__cplusplus_winrt` only detected C++/CX (which can be used without compiling for UWP, SetHandleInformation would be available in those cases), and did not detect native UWP C++. This patch fixes that by using the WINAPI_FAMILY_PARTITION macro in the Windows SDK headers in the same way those headers remove SetHandleInformation in UWP builds.
2019-11-03 22:41:55 -05:00

View File

@ -130,7 +130,7 @@ SPDLOG_INLINE void prevent_child_fd(FILE *f)
{
#ifdef _WIN32
#if !defined(__cplusplus_winrt)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
auto file_handle = reinterpret_cast<HANDLE>(_get_osfhandle(::_fileno(f)));
if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0))
SPDLOG_THROW(spdlog_ex("SetHandleInformation failed", errno));