68 lines
2.0 KiB
Diff
68 lines
2.0 KiB
Diff
|
|
From 9ccfe110343369ea8986fb8781a679373b9b8892 Mon Sep 17 00:00:00 2001
|
||
|
|
From: "Dmitry V. Levin" <ldv@strace.io>
|
||
|
|
Date: Thu, 23 Nov 2023 08:00:00 +0000
|
||
|
|
Subject: [PATCH] Fix the type of tcbtab iterators
|
||
|
|
|
||
|
|
* src/strace.c (alloctcb, startup_attach, init, pid2tcb, cleanup):
|
||
|
|
Change the type of tcbtab iterators from unsigned int to size_t so that
|
||
|
|
they match the type of tcbtabsize.
|
||
|
|
|
||
|
|
Reference: https://github.com/strace/strace/commit/9ccfe110343369ea8986fb8781a679373b9b8892
|
||
|
|
Conflict: NA
|
||
|
|
---
|
||
|
|
src/strace.c | 10 +++++-----
|
||
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/strace.c b/src/strace.c
|
||
|
|
index 6f808996e..d3fa44f30 100644
|
||
|
|
--- a/src/strace.c
|
||
|
|
+++ b/src/strace.c
|
||
|
|
@@ -1033,7 +1033,7 @@ alloctcb(int pid)
|
||
|
|
if (nprocs == tcbtabsize)
|
||
|
|
expand_tcbtab();
|
||
|
|
|
||
|
|
- for (unsigned int i = 0; i < tcbtabsize; ++i) {
|
||
|
|
+ for (size_t i = 0; i < tcbtabsize; ++i) {
|
||
|
|
struct tcb *tcp = tcbtab[i];
|
||
|
|
if (!tcp->pid) {
|
||
|
|
memset(tcp, 0, sizeof(*tcp));
|
||
|
|
@@ -1447,7 +1447,7 @@ startup_attach(void)
|
||
|
|
debug_msg("new tracer pid is %d", strace_tracer_pid);
|
||
|
|
}
|
||
|
|
|
||
|
|
- for (unsigned int tcbi = 0; tcbi < tcbtabsize; ++tcbi) {
|
||
|
|
+ for (size_t tcbi = 0; tcbi < tcbtabsize; ++tcbi) {
|
||
|
|
tcp = tcbtab[tcbi];
|
||
|
|
|
||
|
|
if (!tcp->pid)
|
||
|
|
@@ -2761,7 +2761,7 @@ init(int argc, char *argv[])
|
||
|
|
* of tcbs are not filled though tcbs are initialized.
|
||
|
|
* We must fill the fields here.
|
||
|
|
*/
|
||
|
|
- for (unsigned int i = 0; i < tcbtabsize; ++i) {
|
||
|
|
+ for (size_t i = 0; i < tcbtabsize; ++i) {
|
||
|
|
struct tcb *tcp = tcbtab[i];
|
||
|
|
if (tcp->comm[0] == 0)
|
||
|
|
maybe_load_task_comm(tcp);
|
||
|
|
@@ -3090,7 +3090,7 @@ pid2tcb(const int pid)
|
||
|
|
if (tcp && tcp->pid == pid)
|
||
|
|
return tcp;
|
||
|
|
|
||
|
|
- for (unsigned int i = 0; i < tcbtabsize; ++i) {
|
||
|
|
+ for (size_t i = 0; i < tcbtabsize; ++i) {
|
||
|
|
tcp = tcbtab[i];
|
||
|
|
if (tcp->pid == pid)
|
||
|
|
return *ptcp = tcp;
|
||
|
|
@@ -3108,7 +3108,7 @@ cleanup(int fatal_sig)
|
||
|
|
if (!fatal_sig)
|
||
|
|
fatal_sig = SIGTERM;
|
||
|
|
|
||
|
|
- for (unsigned int i = 0; i < tcbtabsize; ++i) {
|
||
|
|
+ for (size_t i = 0; i < tcbtabsize; ++i) {
|
||
|
|
struct tcb *tcp = tcbtab[i];
|
||
|
|
if (!tcp->pid)
|
||
|
|
continue;
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|