Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37743936
en ru br
ALT Linux repos
S:0.7.91.0.198.git82c6640-alt5
5.0: 0.5-alt1
4.1: 0.5-alt1
4.0: 0.4-alt2.0
3.0: 0.3.36-alt2

Group :: Development/Debuggers
RPM: ltrace

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: ltrace-0.7.91.0.198.git82c6640-fix_readdir_r_deprecated.patch
Download


diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index 953fd86..5cf110f 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -242,16 +242,20 @@ 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) {
-		fail:
+                struct dirent *result = NULL;
+                errno = 0;
+                result = readdir(d);
+                if (result == NULL)
+                {
+                        if (errno == 0)
+                                 break;
+                        else {
+                        fail:
 			free(tasks);
 			closedir(d);
 			return -1;
-		}
-		if (result == NULL)
-			break;
+		        }
+                }
 		if (result->d_type == DT_DIR && all_digits(result->d_name)) {
 			pid_t npid = atoi(result->d_name);
 			if (n >= alloc) {
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin