summaryrefslogtreecommitdiffstats
path: root/adb/file_sync_service.c
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2014-03-08 01:34:03 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-03-08 01:34:03 +0000
commitb2c34ece647c212baa30c474394c498a2d6dd61f (patch)
tree86a037fcf852a2f2781c2cd5cf6fdd74d5179135 /adb/file_sync_service.c
parent0c3d19ff3db7b04081a7a729a81642c5903f741a (diff)
parent4ce2f838e78592d0b93776b73ca4de855a423dde (diff)
downloadcore-b2c34ece647c212baa30c474394c498a2d6dd61f.tar.gz
core-b2c34ece647c212baa30c474394c498a2d6dd61f.tar.bz2
core-b2c34ece647c212baa30c474394c498a2d6dd61f.zip
Merge "adb: Don't clobber block devices during push"
Diffstat (limited to 'adb/file_sync_service.c')
-rw-r--r--adb/file_sync_service.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c
index e981c2a50..25bfdc983 100644
--- a/adb/file_sync_service.c
+++ b/adb/file_sync_service.c
@@ -339,11 +339,14 @@ static int do_send(int s, char *path, char *buffer)
if(!tmp || errno) {
mode = 0644;
is_link = 0;
+ } else {
+ struct stat st;
+ /* Don't delete files before copying if they are not "regular" */
+ if(lstat(path, &st) || S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+ adb_unlink(path);
+ }
}
- adb_unlink(path);
-
-
#ifdef HAVE_SYMLINKS
if(is_link)
ret = handle_send_link(s, path, buffer);