]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: Delete unnecessary call to snprintf() in user_ent_hash_build()
authorPeilin Ye <peilin.ye@bytedance.com>
Wed, 25 May 2022 02:52:36 +0000 (19:52 -0700)
committerDavid Ahern <dsahern@kernel.org>
Mon, 30 May 2022 15:54:12 +0000 (09:54 -0600)
'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>
misc/ss.c

index f077bed70e6b8fe7853a51773d2dd915473c4794..790e511d57a943765a0b6164b266e84470bcb3ea 100644 (file)
--- 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') {