adb: symlinks to dirs count as dirs for pull destination.
This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.
Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
diff --git a/adb_utils.cpp b/adb_utils.cpp
index 26e376c..3333fc6 100644
--- a/adb_utils.cpp
+++ b/adb_utils.cpp
@@ -153,7 +153,9 @@
// - Recursive, so it uses stack space relative to number of directory
// components.
- if (directory_exists(path)) {
+ // If path points to a symlink to a directory, that's fine.
+ struct stat sb;
+ if (stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode)) {
return true;
}