SerialHelper: Check error_code to prevent infinite loop. (#725)

This commit is contained in:
Peter Johnson
2017-11-11 22:13:59 -08:00
committed by GitHub
parent 0c83cad70c
commit 7007725d9f

View File

@@ -219,6 +219,7 @@ void SerialHelper::QueryHubPaths(int32_t* status) {
for (auto p = llvm::sys::fs::recursive_directory_iterator(
"/sys/devices/soc0", ec);
p != llvm::sys::fs::recursive_directory_iterator(); p.increment(ec)) {
if (ec) break;
llvm::StringRef path{p->path()};
if (path.find("amba") == llvm::StringRef::npos) continue;
if (path.find("usb") == llvm::StringRef::npos) continue;