[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <dc933ad6a1a6d07dc3b8bf09686fd1a5f4806493.1653446538.git.peilin.ye@bytedance.com>
Date: Tue, 24 May 2022 19:52:36 -0700
From: Peilin Ye <yepeilin.cs@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org
Cc: Peilin Ye <peilin.ye@...edance.com>,
Richard Haines <richard_c_haines@...nternet.com>,
Cong Wang <cong.wang@...edance.com>,
Peilin Ye <yepeilin.cs@...il.com>
Subject: [PATCH iproute2-next 4/7] ss: Delete unnecessary call to snprintf() in user_ent_hash_build()
From: Peilin Ye <peilin.ye@...edance.com>
'name' is already $PROC_ROOT/$PID/fd/$FD there, no need to rebuild the
string.
Signed-off-by: Peilin Ye <peilin.ye@...edance.com>
---
misc/ss.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index dd7b67a76255..ec14d746c669 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -652,10 +652,7 @@ static void user_ent_hash_build(void)
sscanf(lnk, "socket:[%u]", &ino);
- snprintf(tmp, sizeof(tmp), "%s/%d/fd/%s",
- root, pid, d1->d_name);
-
- if (getfilecon(tmp, &sock_context) <= 0)
+ if (getfilecon(name, &sock_context) <= 0)
sock_context = strdup(no_ctx);
if (process[0] == '\0') {
--
2.20.1
Powered by blists - more mailing lists