base: add SystemErrorCodeToString() function.
Pulls the Windows error string generation out of adb into libbase so
that it can be used by fastboot as well. Also makes a Unix equivalent
that just wraps strerror() so that upcoming fastboot error reporting
code can be platform-independent.
The intent here is just to provide a portable way to report an error to
the user. More general cross-platform error handling is out of scope.
Bug: http://b/26236380
Change-Id: I5a784a844775949562d069bb41dcb0ebd13a32bc
diff --git a/adb_auth_host.cpp b/adb_auth_host.cpp
index facacef..8f154fd 100644
--- a/adb_auth_host.cpp
+++ b/adb_auth_host.cpp
@@ -43,6 +43,7 @@
#include "mincrypt/rsa.h"
#undef RSA_verify
+#include <android-base/errors.h>
#include <android-base/strings.h>
#include <cutils/list.h>
@@ -307,8 +308,7 @@
WCHAR path[MAX_PATH];
const HRESULT hr = SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path);
if (FAILED(hr)) {
- D("SHGetFolderPathW failed: %s",
- SystemErrorCodeToString(hr).c_str());
+ D("SHGetFolderPathW failed: %s", android::base::SystemErrorCodeToString(hr).c_str());
return -1;
}
if (!android::base::WideToUTF8(path, &home_str)) {