From 323899b6d3d63a9cf3fbb7f47946a9c411e5f8d2 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 3 Feb 2016 14:55:24 -0800 Subject: [PATCH] adb: don't append a slash to a path that already ends with one. Bug: http://b/26964908 Change-Id: I1fbd752fd97f5414a306b46f7bfce3373362f8b3 --- adb/file_sync_client.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index 0fa591705..51fc1433d 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -753,8 +753,11 @@ bool do_sync_push(const std::vector& srcs, const char* dst) { if (dst_isdir) { // If we're copying a local file to a remote directory, // we really want to copy to remote_dir + "/" + local_filename. - path_holder = android::base::StringPrintf( - "%s/%s", dst_path, adb_basename(src_path).c_str()); + path_holder = dst_path; + if (path_holder.back() != '/') { + path_holder.push_back('/'); + } + path_holder += adb_basename(src_path); dst_path = path_holder.c_str(); } sc.SetExpectedTotalBytes(st.st_size);