hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 64f98f84fd88797e219f9dde1ca387fee4b509f0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 24 Apr 2016 16:58:17 -0700
Subject: [PATCH] replace readdir_r with readdir
 
glibc 2.24 has deprecated readdir_r
 
https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html
 
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted
 
 sysdeps/linux-gnu/proc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
 
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index 953fd86..edb716d 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -242,9 +242,10 @@ process_tasks(pid_t pid, pid_t **ret_tasks, size_t *ret_n)
     size_t alloc = 0;
 
     while (1) {
-        struct dirent entry;
         struct dirent *result;
-        if (readdir_r(d, &entry, &result) != 0) {
+        errno = 0;
+        result = readdir(d);
+        if (errno != 0) {
         fail:
             free(tasks);
             closedir(d);
-- 
2.8.0