Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2-next] misc: ss.c: fix logical error in main function
@ 2025-07-19 16:31 Anton Moryakov
  2025-07-20 15:15 ` Stephen Hemminger
  2025-07-29 23:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Moryakov @ 2025-07-19 16:31 UTC (permalink / raw)
  To: netdev; +Cc: Anton Moryakov

In the line if (!dump_tcpdiag) { there was a logical error 
in checking the descriptor, which the static analyzer complained 
about (this action is always false)

fixed by replacing !dump_tcpdiag with !dump_fp

Reported-by: SVACE static analyzer
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
---
 misc/ss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/ss.c b/misc/ss.c
index de02fccb..20d0766d 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -6228,7 +6228,7 @@ int main(int argc, char *argv[])
 		}
 		if (dump_tcpdiag[0] != '-') {
 			dump_fp = fopen(dump_tcpdiag, "w");
-			if (!dump_tcpdiag) {
+			if (!dump_fp) {
 				perror("fopen dump file");
 				exit(-1);
 			}
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-29 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-19 16:31 [PATCH iproute2-next] misc: ss.c: fix logical error in main function Anton Moryakov
2025-07-20 15:15 ` Stephen Hemminger
2025-07-29 23:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox