diff --git a/libraries/libstratosphere/source/ams/ams_environment.cpp b/libraries/libstratosphere/source/ams/ams_environment.cpp index 3a0bb3ed9..0c92a6434 100644 --- a/libraries/libstratosphere/source/ams/ams_environment.cpp +++ b/libraries/libstratosphere/source/ams/ams_environment.cpp @@ -197,10 +197,15 @@ extern "C" { } +namespace { + + constinit ams::os::Mutex g_abort_lock(true); + +} + /* Custom abort handler, so that std::abort will trigger these. */ void abort() { - static ams::os::Mutex abort_lock(true); - std::scoped_lock lk(abort_lock); + std::scoped_lock lk(g_abort_lock); ams::AbortImpl(); __builtin_unreachable(); diff --git a/libraries/libstratosphere/source/os/impl/os_thread_manager.cpp b/libraries/libstratosphere/source/os/impl/os_thread_manager.cpp index d58c4c321..f063812de 100644 --- a/libraries/libstratosphere/source/os/impl/os_thread_manager.cpp +++ b/libraries/libstratosphere/source/os/impl/os_thread_manager.cpp @@ -220,7 +220,7 @@ namespace ams::os::impl { constexpr size_t ThreadNamePrefixSize = sizeof(ThreadNamePrefix) - 1; const u64 func = reinterpret_cast(thread->function); static_assert(ThreadNamePrefixSize + sizeof(func) * 2 + 1 <= sizeof(thread->name_buffer)); - std::snprintf(thread->name_buffer, sizeof(thread->name_buffer), "%s%016lX", ThreadNamePrefix, func); + util::SNPrintf(thread->name_buffer, sizeof(thread->name_buffer), "%s%016lX", ThreadNamePrefix, func); } thread->name_pointer = thread->name_buffer;