diff options
author | Elliott Hughes <enh@google.com> | 2015-05-01 17:04:38 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-05-01 17:37:28 -0700 |
commit | e1a55004e9fa46055c59f86e952e9e457c36c3f2 (patch) | |
tree | 7641d408bf403954720299492240fb4690674214 /adb/remount_service.cpp | |
parent | 92af733ee202caa3b5475fe27fcc81582f11e7c8 (diff) | |
download | system_core-e1a55004e9fa46055c59f86e952e9e457c36c3f2.zip system_core-e1a55004e9fa46055c59f86e952e9e457c36c3f2.tar.gz system_core-e1a55004e9fa46055c59f86e952e9e457c36c3f2.tar.bz2 |
Add WriteFdFmt and clean up more code.
Also say *which* device wasn't found.
Bug: http://b/20666660
Change-Id: I50e234ad89e39ae0a8995083c0b642c61275c5a3
(cherry picked from commit ab52c181fa4c1c9891644635dc5653cda5b90e2b)
Diffstat (limited to 'adb/remount_service.cpp')
-rw-r--r-- | adb/remount_service.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/adb/remount_service.cpp b/adb/remount_service.cpp index 3fb2fcb..87702b0 100644 --- a/adb/remount_service.cpp +++ b/adb/remount_service.cpp @@ -90,9 +90,7 @@ static bool remount_partition(int fd, const char* partition, int* ro) { return true; } if (remount(partition, ro)) { - char buf[200]; - snprintf(buf, sizeof(buf), "remount of %s failed: %s\n", partition, strerror(errno)); - WriteFdExactly(fd, buf); + WriteFdFmt(fd, "remount of %s failed: %s\n", partition, strerror(errno)); return false; } return true; @@ -121,14 +119,12 @@ void remount_service(int fd, void* cookie) { if (system_verified || vendor_verified) { // Allow remount but warn of likely bad effects bool both = system_verified && vendor_verified; - char buffer[200]; - snprintf(buffer, sizeof(buffer), - "dm_verity is enabled on the %s%s%s partition%s.\n", - system_verified ? "system" : "", - both ? " and " : "", - vendor_verified ? "vendor" : "", - both ? "s" : ""); - WriteFdExactly(fd, buffer); + WriteFdFmt(fd, + "dm_verity is enabled on the %s%s%s partition%s.\n", + system_verified ? "system" : "", + both ? " and " : "", + vendor_verified ? "vendor" : "", + both ? "s" : ""); WriteFdExactly(fd, "Use \"adb disable-verity\" to disable verity.\n" "If you do not, remount may succeed, however, you will still " |