summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-10-07 22:29:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-10-07 22:29:32 +0000
commit69627e52b9cd071bc07e490f77ae9860b452cd9c (patch)
treee96134cea2d04ac303cf1ce483feb0b82db9e94e
parent07577e3778d73af4b111cee3260c09f7193f3276 (diff)
parent7fb14071252d7fcaab028dc3cbbe2bbc0a4f6c51 (diff)
Merge "adb: log more detail on failure to read keys."
-rw-r--r--adb/client/auth.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/adb/client/auth.cpp b/adb/client/auth.cpp
index ed6a9a8aa..e8be784cd 100644
--- a/adb/client/auth.cpp
+++ b/adb/client/auth.cpp
@@ -173,7 +173,8 @@ static std::shared_ptr<RSA> read_key_file(const std::string& file) {
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 @@ static std::string get_user_key_path() {
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 @@ static void adb_auth_inotify_init(const std::set<std::string>& paths) {
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;
}