Merge pull request #1296 from sylveon/patch-1

Correctly guard SetHandleInformation API call
This commit is contained in:
Gabi Melman 2019-11-04 10:58:14 +02:00 committed by GitHub
commit d67efb2cab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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