From e6918187568dbd01842d8d1d2c808ce16a894239 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:54:28 +0200 Subject: Adding upstream version 18.2.2. Signed-off-by: Daniel Baumann --- src/common/errno.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/common/errno.cc (limited to 'src/common/errno.cc') diff --git a/src/common/errno.cc b/src/common/errno.cc new file mode 100644 index 000000000..83992361c --- /dev/null +++ b/src/common/errno.cc @@ -0,0 +1,22 @@ +#include "common/errno.h" +#include "acconfig.h" +#include "include/compat.h" + +#include +#include + +std::string cpp_strerror(int err) +{ + char buf[128]; + char *errmsg; + + if (err < 0) + err = -err; + std::ostringstream oss; + + errmsg = ceph_strerror_r(err, buf, sizeof(buf)); + + oss << "(" << err << ") " << errmsg; + + return oss.str(); +} -- cgit v1.2.3