Merge "adb: log more detail on failure to read keys." am: 69627e52b9 am: b186f5fe1f am: e90be182c9
am: 1326886206
Change-Id: Id4008dbce31c42dcaf8eb9be03660a51aa1dfa7a
diff --git a/adb/client/auth.cpp b/adb/client/auth.cpp
index ed6a9a8..e8be784 100644
--- a/adb/client/auth.cpp
+++ b/adb/client/auth.cpp
@@ -173,7 +173,8 @@
RSA* key = RSA_new();
if (!PEM_read_RSAPrivateKey(fp.get(), &key, nullptr, nullptr)) {
- LOG(ERROR) << "Failed to read key";
+ LOG(ERROR) << "Failed to read key from '" << file << "'";
+ ERR_print_errors_fp(stderr);
RSA_free(key);
return nullptr;
}
@@ -249,7 +250,7 @@
return adb_get_android_dir_path() + OS_PATH_SEPARATOR + "adbkey";
}
-static bool generate_userkey() {
+static bool load_userkey() {
std::string path = get_user_key_path();
if (path.empty()) {
PLOG(ERROR) << "Error getting user key filename";
@@ -435,8 +436,8 @@
void adb_auth_init() {
LOG(INFO) << "adb_auth_init...";
- if (!generate_userkey()) {
- LOG(ERROR) << "Failed to generate user key";
+ if (!load_userkey()) {
+ LOG(ERROR) << "Failed to load (or generate) user key";
return;
}