summaryrefslogtreecommitdiff
path: root/adb/file_sync_client.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-11-18 15:17:07 -0800
committerJosh Gao <jmgao@google.com>2016-11-21 18:39:21 -0800
commit05a3abfef34b7b7b0f4358c15fe5410cc088aa03 (patch)
tree40783e4d095a03f8c94c95a779352efee07d4aa7 /adb/file_sync_client.cpp
parentb6552f376ca2903d987faa9b05808d72952af858 (diff)
adb: make sure that file mode macros match linux.
We use <sys/stat.h> mode macros on the host to parse modes sent over from the device, so they had better match. Add static_asserts to ensure this. (Also, fix the cases where they don't.) Test: mma -j48, compiled the static_asserts on darwin manually Change-Id: I883e4e6c7489ea64d3c02d26790ac8293366d989
Diffstat (limited to 'adb/file_sync_client.cpp')
-rw-r--r--adb/file_sync_client.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp
index 115095c9a1..caa7a5f6b6 100644
--- a/adb/file_sync_client.cpp
+++ b/adb/file_sync_client.cpp
@@ -43,6 +43,7 @@
#include "adb_utils.h"
#include "file_sync_service.h"
#include "line_printer.h"
+#include "sysdeps/stat.h"
#include <android-base/file.h>
#include <android-base/strings.h>
@@ -64,15 +65,11 @@ static void ensure_trailing_separators(std::string& local_path, std::string& rem
}
static bool should_pull_file(mode_t mode) {
- return mode & (S_IFREG | S_IFBLK | S_IFCHR);
+ return S_ISREG(mode) || S_ISBLK(mode) || S_ISCHR(mode);
}
static bool should_push_file(mode_t mode) {
- mode_t mask = S_IFREG;
-#if !defined(_WIN32)
- mask |= S_IFLNK;
-#endif
- return mode & mask;
+ return S_ISREG(mode) || S_ISLNK(mode);
}
struct copyinfo {