diff options
author | Elliott Hughes <enh@google.com> | 2015-01-12 14:26:36 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-01-12 17:00:09 -0800 |
commit | 0a049b1d8dbb1877fd9cd3ca7c3f39e72b3b6c04 (patch) | |
tree | f4f3dbe476e94f693d45b81f56761c8af88be424 /adb | |
parent | ec556521e23f66ea52e41a7d9540b2dec31766c5 (diff) | |
download | system_core-0a049b1d8dbb1877fd9cd3ca7c3f39e72b3b6c04.zip system_core-0a049b1d8dbb1877fd9cd3ca7c3f39e72b3b6c04.tar.gz system_core-0a049b1d8dbb1877fd9cd3ca7c3f39e72b3b6c04.tar.bz2 |
Clean up adb Win32 symlink #ifdefs.
Change-Id: I83ef30e82d820f91960c29f6b737e6e900caaca6
Diffstat (limited to 'adb')
-rw-r--r-- | adb/file_sync_client.c | 6 | ||||
-rw-r--r-- | adb/file_sync_service.c | 55 |
2 files changed, 26 insertions, 35 deletions
diff --git a/adb/file_sync_client.c b/adb/file_sync_client.c index 7fb3e3b..ee09d5d 100644 --- a/adb/file_sync_client.c +++ b/adb/file_sync_client.c @@ -309,7 +309,9 @@ static int write_data_buffer(int fd, char* file_buffer, int size, syncsendbuf *s return err; } -#ifdef HAVE_SYMLINKS +#if defined(_WIN32) +extern int write_data_link(int fd, const char *path, syncsendbuf *sbuf) __attribute__((error("no symlinks on Windows"))); +#else static int write_data_link(int fd, const char *path, syncsendbuf *sbuf) { int len, ret; @@ -364,10 +366,8 @@ static int sync_send(int fd, const char *lpath, const char *rpath, free(file_buffer); } else if (S_ISREG(mode)) write_data_file(fd, lpath, sbuf, show_progress); -#ifdef HAVE_SYMLINKS else if (S_ISLNK(mode)) write_data_link(fd, lpath, sbuf); -#endif else goto fail; diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c index 7933858..7de82b7 100644 --- a/adb/file_sync_service.c +++ b/adb/file_sync_service.c @@ -270,7 +270,9 @@ fail: return -1; } -#ifdef HAVE_SYMLINKS +#if defined(_WIN32) +extern int handle_send_link(int s, char *path, char *buffer) __attribute__((error("no symlinks on Windows"))); +#else static int handle_send_link(int s, char *path, char *buffer) { syncmsg msg; @@ -321,25 +323,20 @@ static int handle_send_link(int s, char *path, char *buffer) return 0; } -#endif /* HAVE_SYMLINKS */ +#endif static int do_send(int s, char *path, char *buffer) { - char *tmp; unsigned int mode; - int is_link, ret; + bool is_link = false; bool do_unlink; - tmp = strrchr(path,','); + char* tmp = strrchr(path,','); if(tmp) { *tmp = 0; errno = 0; mode = strtoul(tmp + 1, NULL, 0); -#ifndef HAVE_SYMLINKS - is_link = 0; -#else is_link = S_ISLNK((mode_t) mode); -#endif mode &= 0777; } if(!tmp || errno) { @@ -355,32 +352,26 @@ static int do_send(int s, char *path, char *buffer) } } -#ifdef HAVE_SYMLINKS - if(is_link) - ret = handle_send_link(s, path, buffer); - else { -#else - { -#endif - uid_t uid = -1; - gid_t gid = -1; - uint64_t cap = 0; + if (is_link) { + return handle_send_link(s, path, buffer); + } - /* copy user permission bits to "group" and "other" permissions */ - mode |= ((mode >> 3) & 0070); - mode |= ((mode >> 3) & 0007); + uid_t uid = -1; + gid_t gid = -1; + uint64_t cap = 0; - tmp = path; - if(*tmp == '/') { - tmp++; - } - if (is_on_system(path) || is_on_vendor(path)) { - fs_config(tmp, 0, &uid, &gid, &mode, &cap); - } - ret = handle_send_file(s, path, uid, gid, mode, buffer, do_unlink); - } + /* copy user permission bits to "group" and "other" permissions */ + mode |= ((mode >> 3) & 0070); + mode |= ((mode >> 3) & 0007); - return ret; + tmp = path; + if(*tmp == '/') { + tmp++; + } + if (is_on_system(path) || is_on_vendor(path)) { + fs_config(tmp, 0, &uid, &gid, &mode, &cap); + } + return handle_send_file(s, path, uid, gid, mode, buffer, do_unlink); } static int do_recv(int s, const char *path, char *buffer) |