diff options
author | Elliott Hughes <enh@google.com> | 2015-05-01 17:04:38 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-05-01 17:37:28 -0700 |
commit | e1a55004e9fa46055c59f86e952e9e457c36c3f2 (patch) | |
tree | 7641d408bf403954720299492240fb4690674214 /adb/adb.cpp | |
parent | 92af733ee202caa3b5475fe27fcc81582f11e7c8 (diff) | |
download | system_core-e1a55004e9fa46055c59f86e952e9e457c36c3f2.zip system_core-e1a55004e9fa46055c59f86e952e9e457c36c3f2.tar.gz system_core-e1a55004e9fa46055c59f86e952e9e457c36c3f2.tar.bz2 |
Add WriteFdFmt and clean up more code.
Also say *which* device wasn't found.
Bug: http://b/20666660
Change-Id: I50e234ad89e39ae0a8995083c0b642c61275c5a3
(cherry picked from commit ab52c181fa4c1c9891644635dc5653cda5b90e2b)
Diffstat (limited to 'adb/adb.cpp')
-rw-r--r-- | adb/adb.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/adb/adb.cpp b/adb/adb.cpp index 11c65da..8a7b9c9 100644 --- a/adb/adb.cpp +++ b/adb/adb.cpp @@ -89,10 +89,8 @@ void start_device_log(void) { char timestamp[PATH_MAX]; strftime(timestamp, sizeof(timestamp), "%Y-%m-%d-%H-%M-%S", &now); - char path[PATH_MAX]; - snprintf(path, sizeof(path), "/data/adb/adb-%s-%d", timestamp, getpid()); - - int fd = unix_open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640); + std::string path = android::base::StringPrintf("/data/adb/adb-%s-%d", timestamp, getpid()); + int fd = unix_open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640); if (fd == -1) { return; } |