mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
win: implement ErrnoMessage
R=mark@chromium.org BUG=crashpad:1 Review URL: https://codereview.chromium.org/816223007
This commit is contained in:
parent
cb8c01f410
commit
92d5c41964
@ -16,17 +16,30 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "base/safe_strerror_posix.h"
|
#include "build/build_config.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
|
|
||||||
|
#if defined(OS_POSIX)
|
||||||
|
#include "base/safe_strerror_posix.h"
|
||||||
|
#elif defined(OS_WIN)
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
std::string ErrnoMessage(int err, const std::string& base) {
|
std::string ErrnoMessage(int err, const std::string& base) {
|
||||||
|
#if defined(OS_POSIX)
|
||||||
|
std::string err_as_string = safe_strerror(errno);
|
||||||
|
const char* err_string = err_as_string.c_str();
|
||||||
|
#elif defined(OS_WIN)
|
||||||
|
char err_string[256];
|
||||||
|
strerror_s(err_string, errno);
|
||||||
|
#endif
|
||||||
return base::StringPrintf("%s%s%s (%d)",
|
return base::StringPrintf("%s%s%s (%d)",
|
||||||
base.c_str(),
|
base.c_str(),
|
||||||
base.empty() ? "" : ": ",
|
base.empty() ? "" : ": ",
|
||||||
safe_strerror(errno).c_str(),
|
err_string,
|
||||||
err);
|
err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user