fastbootd: Allow returning errors from getvar handlers.

Currently a few getvar handlers will return invalid strings when an
error occurs. This change allows those handlers to instead send a proper
failure message.

Bug: 78793464
Test: N/A
Change-Id: I7ff7d036c1e6fb0a3d700ecf21b1103ab77278d2
diff --git a/fastboot/device/commands.cpp b/fastboot/device/commands.cpp
index ac381fb..0e4a68b 100644
--- a/fastboot/device/commands.cpp
+++ b/fastboot/device/commands.cpp
@@ -37,8 +37,7 @@
 using ::android::hardware::boot::V1_0::Slot;
 
 bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args) {
-    using VariableHandler =
-            std::function<std::string(FastbootDevice*, const std::vector<std::string>&)>;
+    using VariableHandler = std::function<bool(FastbootDevice*, const std::vector<std::string>&)>;
     const std::unordered_map<std::string, VariableHandler> kVariableMap = {
             {FB_VAR_VERSION, GetVersion},
             {FB_VAR_VERSION_BOOTLOADER, GetBootloaderVersion},
@@ -61,8 +60,7 @@
     }
 
     std::vector<std::string> getvar_args(args.begin() + 2, args.end());
-    auto result = found_variable->second(device, getvar_args);
-    return device->WriteStatus(FastbootResult::OKAY, result);
+    return found_variable->second(device, getvar_args);
 }
 
 bool DownloadHandler(FastbootDevice* device, const std::vector<std::string>& args) {