crosstool-ng/packages/ltrace/0.7.3/0007-glibc-2.24.patch
Alexey Neyman 98bc4decde Run all patches through renumbering and update
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-12-02 12:44:39 -08:00

32 lines
662 B
Diff

---
sysdeps/linux-gnu/proc.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -240,14 +240,18 @@
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) {