Merge "fastboot: Remove '\n' from interface name on linux" into main

This commit is contained in:
Treehugger Robot 2024-02-08 03:11:53 +00:00 committed by Gerrit Code Review
commit 241046adaa

View file

@ -269,6 +269,9 @@ static int filter_usb_device(char* sysfs_name,
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());
}