diff options
author | JP Abgrall <jpa@google.com> | 2014-03-08 01:56:36 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-08 01:56:36 +0000 |
commit | 270ebefc6c0c7937e8bef112a257b25509a1c2b7 (patch) | |
tree | 37e468de68974e7e5a43d8c7b9d034683d7ba6e1 /adb | |
parent | c1790a0b99bd55ec1eb2201e60e8c2167a334c7c (diff) | |
parent | b2c34ece647c212baa30c474394c498a2d6dd61f (diff) | |
download | system_core-270ebefc6c0c7937e8bef112a257b25509a1c2b7.zip system_core-270ebefc6c0c7937e8bef112a257b25509a1c2b7.tar.gz system_core-270ebefc6c0c7937e8bef112a257b25509a1c2b7.tar.bz2 |
am b2c34ece: Merge "adb: Don\'t clobber block devices during push"
* commit 'b2c34ece647c212baa30c474394c498a2d6dd61f':
adb: Don't clobber block devices during push
Diffstat (limited to 'adb')
-rw-r--r-- | adb/file_sync_service.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c index e981c2a..25bfdc9 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); |