summaryrefslogtreecommitdiffstats
path: root/adb/remount_service.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-30 17:32:03 -0700
committerElliott Hughes <enh@google.com>2015-05-01 17:09:34 -0700
commit92af733ee202caa3b5475fe27fcc81582f11e7c8 (patch)
tree0e5d4bc49cc6299f80a0cccd4ba205d5dfcbb3cb /adb/remount_service.cpp
parent5cffd971997ace97ebfd2ecb7d43a64c03cf3169 (diff)
downloadsystem_core-92af733ee202caa3b5475fe27fcc81582f11e7c8.zip
system_core-92af733ee202caa3b5475fe27fcc81582f11e7c8.tar.gz
system_core-92af733ee202caa3b5475fe27fcc81582f11e7c8.tar.bz2
More adb buffer fixes.
This patch factors out a lot of the basic protocol code: sending OKAY, sending FAIL, and sending a length-prefixed string. ADB_TRACE has been non-optional for a long time, so let's just remove the #ifs. Also actually build the device tracker test tool (and remove its duplicate). Bug: http://b/20666660 Change-Id: I6c7d59f18707bdc62ca69dea45547617f9f31fc6 (cherry picked from commit e67f1f87d9b1188ec8617035db7006c37ee7b21e)
Diffstat (limited to 'adb/remount_service.cpp')
-rw-r--r--adb/remount_service.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/adb/remount_service.cpp b/adb/remount_service.cpp
index 1eaee73..3fb2fcb 100644
--- a/adb/remount_service.cpp
+++ b/adb/remount_service.cpp
@@ -92,7 +92,7 @@ static bool remount_partition(int fd, const char* partition, int* ro) {
if (remount(partition, ro)) {
char buf[200];
snprintf(buf, sizeof(buf), "remount of %s failed: %s\n", partition, strerror(errno));
- WriteStringFully(fd, buf);
+ WriteFdExactly(fd, buf);
return false;
}
return true;
@@ -102,7 +102,7 @@ void remount_service(int fd, void* cookie) {
char prop_buf[PROPERTY_VALUE_MAX];
if (getuid() != 0) {
- WriteStringFully(fd, "Not running as root. Try \"adb root\" first.\n");
+ WriteFdExactly(fd, "Not running as root. Try \"adb root\" first.\n");
adb_close(fd);
return;
}
@@ -128,12 +128,11 @@ void remount_service(int fd, void* cookie) {
both ? " and " : "",
vendor_verified ? "vendor" : "",
both ? "s" : "");
- WriteStringFully(fd, buffer);
- snprintf(buffer, sizeof(buffer),
- "Use \"adb disable-verity\" to disable verity.\n"
- "If you do not, remount may succeed, however, you will still "
- "not be able to write to these volumes.\n");
- WriteStringFully(fd, buffer);
+ WriteFdExactly(fd, buffer);
+ WriteFdExactly(fd,
+ "Use \"adb disable-verity\" to disable verity.\n"
+ "If you do not, remount may succeed, however, you will still "
+ "not be able to write to these volumes.\n");
}
bool success = true;
@@ -141,7 +140,7 @@ void remount_service(int fd, void* cookie) {
success &= remount_partition(fd, "/vendor", &vendor_ro);
success &= remount_partition(fd, "/oem", &oem_ro);
- WriteStringFully(fd, success ? "remount succeeded\n" : "remount failed\n");
+ WriteFdExactly(fd, success ? "remount succeeded\n" : "remount failed\n");
adb_close(fd);
}