diff options
author | Elliott Hughes <enh@google.com> | 2016-09-28 13:29:54 -0700 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2016-12-09 04:59:43 +0100 |
commit | 821ba553140387c31998977cbb490f3c7b96eadc (patch) | |
tree | 8cfb51c81ff37806fc69acc52cc55341aba3a268 /libprocessgroup | |
parent | 7f2bb91aecbdc8af268c56f80034d8f3dc0204aa (diff) | |
download | system_core-821ba553140387c31998977cbb490f3c7b96eadc.zip system_core-821ba553140387c31998977cbb490f3c7b96eadc.tar.gz system_core-821ba553140387c31998977cbb490f3c7b96eadc.tar.bz2 |
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 ad0500d..0fa835b 100644 --- a/libprocessgroup/processgroup.cpp +++ b/libprocessgroup/processgroup.cpp @@ -164,9 +164,8 @@ static void removeUidProcessGroups(const char *uid_path) { DIR *uid = opendir(uid_path); if (uid != NULL) { - struct dirent cur; - struct dirent *dir; - while ((readdir_r(uid, &cur, &dir) == 0) && dir) { + dirent* dir; + while ((dir = readdir(uid.get())) != nullptr) { char path[PROCESSGROUP_MAX_PATH_LEN]; if (dir->d_type != DT_DIR) { @@ -192,9 +191,8 @@ void removeAllProcessGroups() if (root == NULL) { SLOGE("failed to open %s: %s", PROCESSGROUP_CGROUP_PATH, strerror(errno)); } else { - struct dirent cur; - struct dirent *dir; - while ((readdir_r(root, &cur, &dir) == 0) && dir) { + dirent* dir; + while ((dir = readdir(root.get())) != nullptr) { char path[PROCESSGROUP_MAX_PATH_LEN]; if (dir->d_type != DT_DIR) { |