From: Otto Moerbeek Date: Mon, 9 Jan 2023 09:22:19 +0000 (+0100) Subject: Introduce a thread-safe version of stringerror() X-Git-Tag: dnsdist-1.8.0-rc1~115^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c20313ec56a0d0c9ef15e5bc678a69df73d51bef;p=thirdparty%2Fpdns.git Introduce a thread-safe version of stringerror() It turns out we already have the code, so call it. --- diff --git a/pdns/misc.cc b/pdns/misc.cc index 7e5cb07063..efcf8779ec 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -517,16 +517,6 @@ string bitFlip(const string &str) return ret; } -string stringerror(int err) -{ - return strerror(err); -} - -string stringerror() -{ - return strerror(errno); -} - void cleanSlashes(string &str) { string::const_iterator i; diff --git a/pdns/misc.hh b/pdns/misc.hh index 437cb63ea0..231d626aca 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -161,8 +161,12 @@ const string toLower(const string &upper); const string toLowerCanonic(const string &upper); bool IpToU32(const string &str, uint32_t *ip); string U32ToIP(uint32_t); -string stringerror(int); -string stringerror(); + +inline string stringerror(int err = errno) +{ + return pdns::getMessageFromErrno(err); +} + string bitFlip(const string &str); void dropPrivs(int uid, int gid);