diff options
author | Elliott Hughes <enh@google.com> | 2016-09-28 13:29:54 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-09-28 14:04:12 -0700 |
commit | 9f206938edc2243e4e4f5de74d67e15befd95576 (patch) | |
tree | 4e7ad8abe0b1546704777a902ac1bc441ad22440 /libprocessgroup | |
parent | dfd30c4a169e6b9e3da132769f0ad2b626703cd2 (diff) | |
download | system_core-9f206938edc2243e4e4f5de74d67e15befd95576.tar.gz system_core-9f206938edc2243e4e4f5de74d67e15befd95576.tar.bz2 system_core-9f206938edc2243e4e4f5de74d67e15befd95576.zip |
Use readdir instead of readdir_r.
http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html
Test: boots.
Change-Id: If75532e24fe4d17743bf8e8c9590156dee378a63
Diffstat (limited to 'libprocessgroup')
-rw-r--r-- | libprocessgroup/processgroup.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp index 65bbc1e42..7c1542990 100644 --- a/libprocessgroup/processgroup.cpp +++ b/libprocessgroup/processgroup.cpp @@ -203,9 +203,8 @@ static void removeUidProcessGroups(const char *uid_path) { std::unique_ptr<DIR, decltype(&closedir)> uid(opendir(uid_path), closedir); if (uid != NULL) { - struct dirent cur; - struct dirent *dir; - while ((readdir_r(uid.get(), &cur, &dir) == 0) && dir) { + dirent* dir; + while ((dir = readdir(uid.get())) != nullptr) { char path[PROCESSGROUP_MAX_PATH_LEN]; if (dir->d_type != DT_DIR) { @@ -231,9 +230,8 @@ void removeAllProcessGroups() if (root == NULL) { PLOG(ERROR) << "failed to open " << cgroup_root_path; } else { - struct dirent cur; - struct dirent *dir; - while ((readdir_r(root.get(), &cur, &dir) == 0) && dir) { + dirent* dir; + while ((dir = readdir(root.get())) != nullptr) { char path[PROCESSGROUP_MAX_PATH_LEN]; if (dir->d_type != DT_DIR) { |