Merge "Fix unhandled exception when FUSE disabled" am: 20b1532b85

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2282933

Change-Id: Iaceb4670a0032ac31bfe330e3f879b06fa351050
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Paul Crowley 2022-11-09 14:09:34 +00:00 committed by Automerger Merge Worker
commit 3589e76deb

View file

@ -1448,7 +1448,10 @@ bool writeStringToFile(const std::string& payload, const std::string& filename)
status_t AbortFuseConnections() { status_t AbortFuseConnections() {
namespace fs = std::filesystem; namespace fs = std::filesystem;
for (const auto& itEntry : fs::directory_iterator("/sys/fs/fuse/connections")) { static constexpr const char* kFuseConnections = "/sys/fs/fuse/connections";
std::error_code ec;
for (const auto& itEntry : fs::directory_iterator(kFuseConnections, ec)) {
std::string fsPath = itEntry.path().string() + "/filesystem"; std::string fsPath = itEntry.path().string() + "/filesystem";
std::string fs; std::string fs;
@ -1468,6 +1471,11 @@ status_t AbortFuseConnections() {
} }
} }
if (ec) {
LOG(WARNING) << "Failed to iterate through " << kFuseConnections << ": " << ec.message();
return -ec.value();
}
return OK; return OK;
} }