summaryrefslogtreecommitdiff
path: root/src/common/errno.cc
blob: a981ab7119a28773c0fe6b90474eb15898a42fb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "common/errno.h"

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

std::string cpp_strerror(int err)
{
  char buf[128];

  if (err < 0)
    err = -err;
  std::ostringstream oss;
  oss << "(" << err << ") " << strerror_r(err, buf, sizeof(buf));

  return oss.str();
}