diff options
author | Karol Lewandowski <k.lewandowsk@samsung.com> | 2017-04-14 09:36:14 +0200 |
---|---|---|
committer | Karol Lewandowski <k.lewandowsk@samsung.com> | 2017-04-14 09:43:18 +0200 |
commit | c77493cc8d8bd94826bb4441049743d308524c39 (patch) | |
tree | 8dc183e663c789a4f23c5721a38cc21d4d59a435 /src | |
parent | cc9f1be614664565cf5f96ae38b214c4dbeedd76 (diff) | |
download | crash-worker-c77493cc8d8bd94826bb4441049743d308524c39.tar.gz crash-worker-c77493cc8d8bd94826bb4441049743d308524c39.tar.bz2 crash-worker-c77493cc8d8bd94826bb4441049743d308524c39.zip |
crash-stack: Eliminate now-deprecated readdir_r
This commit fixes build break with new toolchain.
Glibc 2.24 deprecated readdir_r() - readdir() now recommended even
for multithreaded programs. This commit fixes following error:
/home/abuild/rpmbuild/BUILD/crash-worker-1.0.0/src/crash-stack/crash-stack.c: In function 'find_crash_tid':
/home/abuild/rpmbuild/BUILD/crash-worker-1.0.0/src/crash-stack/crash-stack.c:891:4: error: 'readdir_r' is deprecated [-Werror=deprecated-declarations]
while (readdir_r(dir, &entry, &dentry) == 0 && dentry) {
^~~~~
Change-Id: I99f22a0de87f2539988e1669ae2149dcac74a4df
Diffstat (limited to 'src')
-rw-r--r-- | src/crash-stack/crash-stack.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/crash-stack/crash-stack.c b/src/crash-stack/crash-stack.c index edda6cd..587e932 100644 --- a/src/crash-stack/crash-stack.c +++ b/src/crash-stack/crash-stack.c @@ -870,8 +870,7 @@ static int find_crash_tid(int pid) int threadnum = 1; int crash_tid = -1; DIR *dir; - struct dirent entry; - struct dirent *dentry = NULL; + struct dirent *entry; char task_path[PATH_MAX]; struct stat sb; @@ -888,12 +887,12 @@ static int find_crash_tid(int pid) fprintf(errfile, "[crash-stack] cannot open %s\n", task_path); return -1; } else { - while (readdir_r(dir, &entry, &dentry) == 0 && dentry) { - if (strcmp(dentry->d_name, ".") == 0 || - strcmp(dentry->d_name, "..") == 0) + while ((entry = readdir(dir)) != NULL) { + if (strcmp(entry->d_name, ".") == 0 || + strcmp(entry->d_name, "..") == 0) continue; crash_tid = check_thread_wchan(pid, - atoi(dentry->d_name)); + atoi(entry->d_name)); if (crash_tid > 0) break; } |