From ea3b57ec3991a576a6aa7276979db518fd5488ce Mon Sep 17 00:00:00 2001 From: Peilin Ye Date: Tue, 24 May 2022 19:52:36 -0700 Subject: [PATCH] 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 Signed-off-by: David Ahern --- misc/ss.c | 5 +---- 1 file changed, 1 insertion(+), 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') { -- 2.47.2