summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2016-11-13 19:56:50 (GMT)
committerAlexey Neyman <stilor@att.net>2016-11-13 19:56:50 (GMT)
commit2fe9c8686d05acfe0c06d6af120ff3a684ceb24a (patch)
tree4667f30204464f65eadc0a5111c417ebeddea476
parent8fbe000639d408f61ba216bbeb42d4a55e45a00a (diff)
Fix ltrace under glibc 2.24.
GLIBC 2.24 declared readdir_r as deprecated and suggests to use readdir. uClibc-ng's readdir is thread-safe as well. Signed-off-by: Alexey Neyman <stilor@att.net>
-rw-r--r--patches/ltrace/0.7.3/008-glibc-2.24.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/patches/ltrace/0.7.3/008-glibc-2.24.patch b/patches/ltrace/0.7.3/008-glibc-2.24.patch
new file mode 100644
index 0000000..85b008b
--- /dev/null
+++ b/patches/ltrace/0.7.3/008-glibc-2.24.patch
@@ -0,0 +1,28 @@
+diff -urpN ltrace-0.7.3.orig/sysdeps/linux-gnu/proc.c ltrace-0.7.3/sysdeps/linux-gnu/proc.c
+--- ltrace-0.7.3.orig/sysdeps/linux-gnu/proc.c 2013-01-02 06:24:46.000000000 -0800
++++ ltrace-0.7.3/sysdeps/linux-gnu/proc.c 2016-11-13 11:24:32.760365875 -0800
+@@ -240,14 +240,18 @@ process_tasks(pid_t pid, pid_t **ret_tas
+ size_t alloc = 0;
+
+ while (1) {
+- struct dirent entry;
+ struct dirent *result;
+- if (readdir_r(d, &entry, &result) != 0) {
+- free(tasks);
+- return -1;
+- }
+- if (result == NULL)
++
++ errno = 0;
++ result = readdir(d);
++ if (result == NULL) {
++ if (errno) {
++ free(tasks);
++ closedir(d);
++ return -1;
++ }
+ break;
++ }
+ if (result->d_type == DT_DIR && all_digits(result->d_name)) {
+ pid_t npid = atoi(result->d_name);
+ if (n >= alloc) {