[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5f0a2388e77ae0388a92505c0a24b4e9d00570fb.1653446538.git.peilin.ye@bytedance.com>
Date: Tue, 24 May 2022 19:51:48 -0700
From: Peilin Ye <yepeilin.cs@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org
Cc: Peilin Ye <peilin.ye@...edance.com>,
Richard Haines <richard_c_haines@...nternet.com>,
Cong Wang <cong.wang@...edance.com>,
Peilin Ye <yepeilin.cs@...il.com>
Subject: [PATCH iproute2-next 1/7] ss: Use assignment-suppression character in sscanf()
From: Peilin Ye <peilin.ye@...edance.com>
Use the '*' assignment-suppression character, instead of an
inappropriately named temporary variable.
Signed-off-by: Peilin Ye <peilin.ye@...edance.com>
---
misc/ss.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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);
--
2.20.1
Powered by blists - more mailing lists