app/dumpcap: don't pass negative value to strerror() on error
Checks
Commit Message
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
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/dumpcap/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, 7 Feb 2023 09:00:50 -0800
Stephen Hemminger <stephen@networkplumber.org> wrote:
> 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
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Small bug fix, please apply
07/02/2023 18:00, 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
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Changed the title to highlight the user facing change:
app/dumpcap: fix error message when getting statistics
Applied, thanks.
@@ -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;
}