summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-10-30 15:53:18 -0700
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-10-30 15:53:18 -0700
commita6fb0e05aa95995445c6f2b65f07db26bdbfd46c (patch)
tree9af97253fd18d3c61d8b0d74da8705ff61fe7b60
parent8f98c4b5f011db8637ce1b9361e82d59b13434f4 (diff)
parentc463d2cf9c5717dcd37589deb01615b984266c8c (diff)
downloadsystem_core-a6fb0e05aa95995445c6f2b65f07db26bdbfd46c.zip
system_core-a6fb0e05aa95995445c6f2b65f07db26bdbfd46c.tar.gz
system_core-a6fb0e05aa95995445c6f2b65f07db26bdbfd46c.tar.bz2
Merge "Fix debuggerd's use of readdir_r(3)."
-rw-r--r--debuggerd/backtrace.c7
-rw-r--r--debuggerd/tombstone.c5
2 files changed, 5 insertions, 7 deletions
diff --git a/debuggerd/backtrace.c b/debuggerd/backtrace.c
index 62f7f32..ba76e7d 100644
--- a/debuggerd/backtrace.c
+++ b/debuggerd/backtrace.c
@@ -125,10 +125,9 @@ void dump_backtrace(int fd, pid_t pid, pid_t tid, bool* detach_failed,
char task_path[64];
snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid);
DIR* d = opendir(task_path);
- if (d) {
- struct dirent debuf;
- struct dirent *de;
- while (!readdir_r(d, &debuf, &de) && de) {
+ if (d != NULL) {
+ struct dirent* de = NULL;
+ while ((de = readdir(d)) != NULL) {
if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) {
continue;
}
diff --git a/debuggerd/tombstone.c b/debuggerd/tombstone.c
index 52223da..47a1bf5 100644
--- a/debuggerd/tombstone.c
+++ b/debuggerd/tombstone.c
@@ -405,9 +405,8 @@ static bool dump_sibling_thread_report(const ptrace_context_t* context,
}
bool detach_failed = false;
- struct dirent debuf;
- struct dirent *de;
- while (!readdir_r(d, &debuf, &de) && de) {
+ struct dirent* de;
+ while ((de = readdir(d)) != NULL) {
/* Ignore "." and ".." */
if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) {
continue;