From ef445093f9fbd9a41a91914ef45e6499b3afa54d Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 18 Dec 2023 23:33:10 +0000 Subject: [PATCH] internal: convert uname fields to strings before logging fixes #4188, thanks @jbeich --- src/debug/CrashReporter.cpp | 4 ++-- src/helpers/MiscFunctions.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp index dac96fb3..ff2a5191 100644 --- a/src/debug/CrashReporter.cpp +++ b/src/debug/CrashReporter.cpp @@ -63,8 +63,8 @@ void CrashReporter::createAndSaveCrash(int sig) { struct utsname unameInfo; uname(&unameInfo); - finalCrashReport += - std::format("\tSystem name: {}\n\tNode name: {}\n\tRelease: {}\n\tVersion: {}\n\n", unameInfo.sysname, unameInfo.nodename, unameInfo.release, unameInfo.version); + finalCrashReport += std::format("\tSystem name: {}\n\tNode name: {}\n\tRelease: {}\n\tVersion: {}\n\n", std::string{unameInfo.sysname}, std::string{unameInfo.nodename}, + std::string{unameInfo.release}, std::string{unameInfo.version}); #if defined(__DragonFly__) || defined(__FreeBSD__) const std::string GPUINFO = execAndGet("pciconf -lv | fgrep -A4 vga"); diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index 16650e1b..6eab7e2b 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -577,10 +577,10 @@ void logSystemInfo() { uname(&unameInfo); - Debug::log(LOG, "System name: {}", unameInfo.sysname); - Debug::log(LOG, "Node name: {}", unameInfo.nodename); - Debug::log(LOG, "Release: {}", unameInfo.release); - Debug::log(LOG, "Version: {}", unameInfo.version); + Debug::log(LOG, "System name: {}", std::string{unameInfo.sysname}); + Debug::log(LOG, "Node name: {}", std::string{unameInfo.nodename}); + Debug::log(LOG, "Release: {}", std::string{unameInfo.release}); + Debug::log(LOG, "Version: {}", std::string{unameInfo.version}); Debug::log(NONE, "\n");