summaryrefslogtreecommitdiffstats
path: root/src/common/errno.cc
blob: 83992361c437d4b5cc81002291275b07bee7d50d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "common/errno.h"
#include "acconfig.h"
#include "include/compat.h"

#include <sstream>
#include <string.h>

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();
}