Fix opendir NULL dirp return issue

Bug: 206035991
Test: use forrest to run boottest

Change-Id: I9e77b7d6184a0ee132b8f058f7f83302c54bcb4a
(cherry picked from commit c76c1d5799)
This commit is contained in:
Zhaoming Yin 2022-01-16 08:12:51 -08:00
parent 0b5ab223e1
commit 78e7f9c0f1

View file

@ -156,6 +156,10 @@ std::string FileConnectionDetector::getFullName(const std::string name) const {
void FileConnectionDetector::processExistingFiles() const {
auto dirp = ::opendir(mPath.c_str());
if(dirp == NULL) {
ALOGE("Problem open dir %s, errno: %s", mPath.c_str(), ::strerror(errno));
return;
}
struct dirent *dp;
while ((dp = ::readdir(dirp)) != NULL) {
const std::string name(dp->d_name);