Introduce error_string() as a portable replacement for strerror_r()

This commit is contained in:
Joe Thornber
2015-01-16 12:54:09 +00:00
parent f1130198e1
commit 25b4b526f4
5 changed files with 17 additions and 13 deletions

View File

@@ -13,6 +13,7 @@
#include <unistd.h>
#include "base/error_state.h"
#include "base/error_string.h"
#include "base/nested_output.h"
#include "caching/commands.h"
#include "caching/metadata.h"
@@ -202,10 +203,7 @@ namespace {
int r = ::stat(path.c_str(), &info);
if (r) {
ostringstream msg;
char buffer[128], *ptr;
ptr = ::strerror_r(errno, buffer, sizeof(buffer));
msg << path << ": " << ptr;
msg << path << ": " << error_string(errno);
throw runtime_error(msg.str());
}