summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2025-09-19 22:23:28 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2025-10-04 14:51:17 -0500
commit504ea99cfa2b083965b427121c3f2a273542c7df (patch)
tree85e3a6cf7bb874dc6b1bc539c03d13df2e3bdc2d /Source/Core/Common
parenteec7f65e3342ff82646a7987c9b59e17b45f1cf7 (diff)
CommonFuncs: Add StrerrorString version of LastStrerrorString that accepts an error number.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/CommonFuncs.cpp11
-rw-r--r--Source/Core/Common/CommonFuncs.h5
2 files changed, 11 insertions, 5 deletions
diff --git a/Source/Core/Common/CommonFuncs.cpp b/Source/Core/Common/CommonFuncs.cpp
index 91eed700ab..9d0b3c97b7 100644
--- a/Source/Core/Common/CommonFuncs.cpp
+++ b/Source/Core/Common/CommonFuncs.cpp
@@ -43,13 +43,18 @@ const char* StrErrorWrapper(int error, char* buffer, std::size_t length)
#endif
}
+std::string StrerrorString(int error)
+{
+ char error_message[BUFFER_SIZE];
+
+ return StrErrorWrapper(error, error_message, BUFFER_SIZE);
+}
+
// Wrapper function to get last strerror(errno) string.
// This function might change the error code.
std::string LastStrerrorString()
{
- char error_message[BUFFER_SIZE];
-
- return StrErrorWrapper(errno, error_message, BUFFER_SIZE);
+ return StrerrorString(errno);
}
#ifdef _WIN32
diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h
index 94b97ba469..8737037102 100644
--- a/Source/Core/Common/CommonFuncs.h
+++ b/Source/Core/Common/CommonFuncs.h
@@ -45,8 +45,9 @@ namespace Common
// strerror_r wrapper to handle XSI and GNU versions.
const char* StrErrorWrapper(int error, char* buffer, std::size_t length);
-// Wrapper function to get last strerror(errno) string.
-// This function might change the error code.
+// Wrapper functions to get strerror(errno) string, which itself is not threadsafe.
+// These functions might change the error code.
+std::string StrerrorString(int error);
std::string LastStrerrorString();
#ifdef _WIN32