Merge "fastboot: Remove '\n' from interface name on linux" into main am: 241046adaa
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2955272
Change-Id: I772dfb2fbfadfe48b76f05951e03e648ab2a71fb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/fastboot/usb_linux.cpp b/fastboot/usb_linux.cpp
index b7fd5ed..72e326a 100644
--- a/fastboot/usb_linux.cpp
+++ b/fastboot/usb_linux.cpp
@@ -269,6 +269,9 @@
auto path = android::base::StringPrintf("/sys/bus/usb/devices/%s/%s:1.%d/interface",
sysfs_name, sysfs_name, ifc->bInterfaceNumber);
if (android::base::ReadFileToString(path, &interface)) {
+ if (!interface.empty() && interface.back() == '\n') {
+ interface.pop_back();
+ }
snprintf(info.interface, sizeof(info.interface), "%s", interface.c_str());
}