summaryrefslogtreecommitdiff
path: root/adb/daemon/file_sync_service.cpp
diff options
context:
space:
mode:
authorLuis Hector Chavez <lhchavez@google.com>2018-07-18 19:40:12 -0700
committerLuis Hector Chavez <lhchavez@google.com>2018-07-18 20:38:10 -0700
commit095792c300d0563904224c5a81ad0709bcd234f6 (patch)
tree55374c8050c8a28fcea7722f362647c5474fb1a4 /adb/daemon/file_sync_service.cpp
parentc20c85008d7ad1e8152c426bc4f0abf8196c7643 (diff)
adb: Modernize the service creation
This change removes the void* argument passing and instead uses C++11 features to avoid having to handle memory manually. Bug: None Test: python ./system/core/adb/test_device.py Change-Id: I6380245b2ca583591810e3e363c67c993a107621
Diffstat (limited to 'adb/daemon/file_sync_service.cpp')
-rw-r--r--adb/daemon/file_sync_service.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp
index f7be8f94b..0b713631e 100644
--- a/adb/daemon/file_sync_service.cpp
+++ b/adb/daemon/file_sync_service.cpp
@@ -525,12 +525,11 @@ static bool handle_sync_command(int fd, std::vector<char>& buffer) {
return true;
}
-void file_sync_service(int fd, void*) {
+void file_sync_service(android::base::unique_fd fd) {
std::vector<char> buffer(SYNC_DATA_MAX);
- while (handle_sync_command(fd, buffer)) {
+ while (handle_sync_command(fd.get(), buffer)) {
}
D("sync: done");
- adb_close(fd);
}