diff mbox series

[iproute2-next,1/7] ss: Use assignment-suppression character in sscanf()

Message ID 5f0a2388e77ae0388a92505c0a24b4e9d00570fb.1653446538.git.peilin.ye@bytedance.com (mailing list archive)
State Accepted
Commit 2d866c6d93dbf4fe8169dda4a3a8f4a67fa0a5b9
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:51 a.m. UTC
From: Peilin Ye <peilin.ye@bytedance.com>

Use the '*' assignment-suppression character, instead of an
inappropriately named temporary variable.

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

Patch

diff --git a/misc/ss.c b/misc/ss.c
index 4b3ca9c4e86b..aa9da7e45e53 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -621,9 +621,8 @@  static void user_ent_hash_build(void)
 		char *p;
 		int pid, pos;
 		DIR *dir1;
-		char crap;
 
-		if (sscanf(d->d_name, "%d%c", &pid, &crap) != 1)
+		if (sscanf(d->d_name, "%d%*c", &pid) != 1)
 			continue;
 
 		if (getpidcon(pid, &pid_context) != 0)
@@ -647,7 +646,7 @@  static void user_ent_hash_build(void)
 			ssize_t link_len;
 			char tmp[1024];
 
-			if (sscanf(d1->d_name, "%d%c", &fd, &crap) != 1)
+			if (sscanf(d1->d_name, "%d%*c", &fd) != 1)
 				continue;
 
 			snprintf(name+pos, sizeof(name) - pos, "%d", fd);