From 6d09e2d25d9fa9abcc80ff3e3e206bca201fd0fe Mon Sep 17 00:00:00 2001 From: Umang Parmar Date: Thu, 28 Jul 2022 17:01:55 +0100 Subject: [PATCH] Update log file directory. Last Updated: 2018-05-17 Last Updated: 2018-05-17 Gbp-Pq: Topic system/core Gbp-Pq: Name move-log-file-to-proper-dir.patch --- system/core/adb/adb_utils.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/core/adb/adb_utils.cpp b/system/core/adb/adb_utils.cpp index d1910f1c..9a9568c7 100644 --- a/system/core/adb/adb_utils.cpp +++ b/system/core/adb/adb_utils.cpp @@ -343,6 +343,11 @@ std::string GetLogFilePath() { return temp_path_utf8 + log_name; #else + std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid()); + struct stat st = {0}; + if (stat(log_dir.c_str(), &st) == 0) { + return log_dir; + } const char* tmp_dir = getenv("TMPDIR"); if (tmp_dir == nullptr) tmp_dir = "/tmp"; return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid()); -- 2.30.2