summaryrefslogtreecommitdiff
path: root/src/common/errno.cc
blob: 86dec1c1adffe39502fed1c0d32aa3b17d38865f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <sstream>
#include <string.h>

#include "errno.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();
}