Add WriteFdFmt and clean up more code.
Also say *which* device wasn't found.
Bug: http://b/20666660
Change-Id: I50e234ad89e39ae0a8995083c0b642c61275c5a3
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 @@
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 @@
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 "