Update log file directory.
authorUmang Parmar <umangjparmar@gmail.com>
Thu, 24 Feb 2022 16:58:51 +0000 (16:58 +0000)
committerRoger Shimizu <rosh@debian.org>
Thu, 24 Feb 2022 16:58:51 +0000 (16:58 +0000)
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

index d1910f1c3f938c57ab0e1b3b43a4e4754af5a82d..9a9568c7d19bfb67f86d0f832c86e3415cbdf773 100644 (file)
@@ -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());