Skip to contentSkip to conversation

app/dumpcap: don't pass negative value to strerror() on error

PATCH Applied Stephen Hemminger 2 participants 3 messages Feb 7, 2023 – Mar 12, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/dumpcap: don't pass negative value to strerror() on error

If eth_stats_get fails (for example with -ENOTSUPP) then dumpcap would pass that to strerror which is incorrect.

Fixes 8744f84bb255 ("app/dumpcap: add statistics mode")

Coverity issue: 383136

---
 app/dumpcap/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/dumpcap/main.c +1 -1
index 904eb5a7d7d9..64294bbfb3e6 100644
@@ -500,7 +500,7 @@ static void statistics_loop(void)
 			if (r < 0) {
 				fprintf(stderr,
 					"stats_get for port %u failed: %d (%s)\n",
-					p, r, strerror(r));
+					p, r, strerror(-r));
 				return;
 			}
 
Signature · 1 line
2.39.1
#1 lore raw
Quoted 6 lines · On Tue, 7 Feb 2023 09:00:50 -0800 Stephen Hemminger…

If eth_stats_get fails (for example with -ENOTSUPP) then dumpcap would pass that to strerror which is incorrect.

Fixes 8744f84bb255 ("app/dumpcap: add statistics mode")

Coverity issue: 383136

Small bug fix, please apply

#2 lore raw
In reply to Stephen Hemminger

07/02/2023 18:00, Stephen Hemminger:

Quoted 6 lines

If eth_stats_get fails (for example with -ENOTSUPP) then dumpcap would pass that to strerror which is incorrect.

Fixes 8744f84bb255 ("app/dumpcap: add statistics mode")

Coverity issue: 383136

Changed the title to highlight the user facing change:
app/dumpcap: fix error message when getting statistics

Applied, thanks.