[RFC PATCH v2 08/12] [squash] pidns.c: use long for strtol result

Ákos Uzonyi uzonyi.akos at gmail.com
Fri Jun 12 18:24:02 UTC 2020


---
 pidns.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pidns.c b/pidns.c
index 44bda6ed..7561ed77 100644
--- a/pidns.c
+++ b/pidns.c
@@ -491,7 +491,7 @@ translate_id_dir(struct translate_id_params *tip, const char *path, bool read_ta
 			continue;
 
 		errno = 0;
-		int proc_pid = strtol(entry->d_name, NULL, 10);
+		long proc_pid = strtol(entry->d_name, NULL, 10);
 		if (errno)
 			continue;
 		if ((proc_pid < 1) || (proc_pid > INT_MAX))
@@ -499,7 +499,7 @@ translate_id_dir(struct translate_id_params *tip, const char *path, bool read_ta
 
 		if (read_task_dir) {
 			char task_dir_path[PATH_MAX + 1];
-			snprintf(task_dir_path, sizeof(task_dir_path), "/proc/%d/task", proc_pid);
+			snprintf(task_dir_path, sizeof(task_dir_path), "/proc/%ld/task", proc_pid);
 			translate_id_dir(tip, task_dir_path, false);
 		}
 
-- 
2.27.0



More information about the Strace-devel mailing list