Fix is_wsl() #ifdef guards on non-Linux platforms

This commit is contained in:
Mahmoud Al-Qudsi 2019-02-14 18:30:10 -06:00
parent 552af31ab0
commit 828a704282

View File

@ -159,8 +159,7 @@ bool is_windows_subsystem_for_linux() {
return true;
#elif not defined(__linux__)
return false;
#endif
#else
// We are purposely not using std::call_once as it may invoke locking, which is an unnecessary
// overhead since there's no actual race condition here - even if multiple threads call this
// routine simultaneously the first time around, we just end up needlessly querying uname(2) one
@ -187,6 +186,7 @@ bool is_windows_subsystem_for_linux() {
// Subsequent calls to this function may take place after fork() and before exec() in
// postfork.cpp. Make sure we never dynamically allocate any memory in the fast path!
return wsl_state;
#endif
}
#ifdef HAVE_BACKTRACE_SYMBOLS