From: Peilin Ye Date: Wed, 25 May 2022 02:52:36 +0000 (-0700) Subject: ss: Delete unnecessary call to snprintf() in user_ent_hash_build() X-Git-Tag: v6.0.0~42^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea3b57ec3991a576a6aa7276979db518fd5488ce;p=thirdparty%2Fiproute2.git 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 --- 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') {