]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: Use assignment-suppression character in sscanf()
authorPeilin Ye <peilin.ye@bytedance.com>
Wed, 25 May 2022 02:51:48 +0000 (19:51 -0700)
committerDavid Ahern <dsahern@kernel.org>
Mon, 30 May 2022 15:53:50 +0000 (09:53 -0600)
Use the '*' assignment-suppression character, instead of an
inappropriately named temporary variable.

Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
misc/ss.c

index 57677cf25cff7f0bf329ef256f07c1fc16217edf..251172f15eadacc6aaebc0ed136f4a894f20f070 100644 (file)
--- 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);