diff mbox series

[iproute2-next,4/7] ss: Delete unnecessary call to snprintf() in user_ent_hash_build()

Message ID dc933ad6a1a6d07dc3b8bf09686fd1a5f4806493.1653446538.git.peilin.ye@bytedance.com (mailing list archive)
State Accepted
Commit ea3b57ec3991a576a6aa7276979db518fd5488ce
Delegated to: David Ahern
Headers show
Series ss: Introduce -T, --threads option | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Peilin Ye May 25, 2022, 2:52 a.m. UTC
From: Peilin Ye <peilin.ye@bytedance.com>

'name' is already $PROC_ROOT/$PID/fd/$FD there, no need to rebuild the
string.

Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
---
 misc/ss.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

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') {