Merge "adb: allow symlinks to directories in directory_exists."
am: c10c31e8ba
Change-Id: I9480b98081f9db54955da19a4565c9a458781cdb
diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp
index 7058acb..31d3dc6 100644
--- a/adb/adb_utils.cpp
+++ b/adb/adb_utils.cpp
@@ -75,7 +75,7 @@
bool directory_exists(const std::string& path) {
struct stat sb;
- return lstat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode);
+ return stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode);
}
std::string escape_arg(const std::string& s) {
diff --git a/adb/adb_utils_test.cpp b/adb/adb_utils_test.cpp
index a3bc445..e1b6287 100644
--- a/adb/adb_utils_test.cpp
+++ b/adb/adb_utils_test.cpp
@@ -55,7 +55,6 @@
ASSERT_FALSE(directory_exists(subdir(profiles_dir, "does-not-exist")));
#else
ASSERT_TRUE(directory_exists("/proc"));
- ASSERT_FALSE(directory_exists("/proc/self")); // Symbolic link.
ASSERT_FALSE(directory_exists("/proc/does-not-exist"));
#endif
}