aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeilin Ye <peilin.ye@bytedance.com>2022-05-24 19:52:36 -0700
committerDavid Ahern <dsahern@kernel.org>2022-05-30 09:54:12 -0600
commitea3b57ec3991a576a6aa7276979db518fd5488ce (patch)
tree4515191bdf3443b991390ff750f86631080765fe
parentcd845a85681bf2851b38041587fa75605beebbe9 (diff)
downloadiproute2-ea3b57ec3991a576a6aa7276979db518fd5488ce.tar.gz
ss: Delete unnecessary call to snprintf() in user_ent_hash_build()
'name' is already $PROC_ROOT/$PID/fd/$FD there, no need to rebuild the string. Signed-off-by: Peilin Ye <peilin.ye@bytedance.com> Signed-off-by: David Ahern <dsahern@kernel.org>
-rw-r--r--misc/ss.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/misc/ss.c b/misc/ss.c
index f077bed70..790e511d5 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') {