Change-Id: I3736cc026ac64efd05a9ca0b41f1a60daae3a306
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
bool sensor_loader::get_paths_from_dir(const string &dir_path, vector<string> &hal_paths)
{
DIR *dir = NULL;
- struct dirent *dir_entry = NULL;
+ struct dirent dir_entry;
+ struct dirent *result;
+ string name;
+ int error;
dir = opendir(dir_path.c_str());
return false;
}
- string name;
+ while (true) {
+ error = readdir_r(dir, &dir_entry, &result);
+
+ if (error != 0)
+ continue;
+
+ if (result == NULL)
+ break;
- while ((dir_entry = readdir(dir))) {
- name = string(dir_entry->d_name);
+ name = string(dir_entry.d_name);
if (name == "." || name == "..")
continue;