mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-28 00:28:52 +00:00
98bc4decde
Signed-off-by: Alexey Neyman <stilor@att.net>
32 lines
662 B
Diff
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) {
|