[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240228165133.1799deab@hermes.local>
Date: Wed, 28 Feb 2024 16:51:33 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Denis Kirjanov <kirjanov@...il.com>
Cc: netdev@...r.kernel.org, Denis Kirjanov <dkirjanov@...e.de>
Subject: Re: [PATCH iproute2] ifstat: handle unlink return value
On Wed, 21 Feb 2024 07:04:24 -0500
Denis Kirjanov <kirjanov@...il.com> wrote:
> Print an error message if we can't remove the history file
>
> Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
> ---
Good idea, but would like the output and result to look like
the other errors in ifstat about history file. Something like:
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 767cedd4aa47..72901097e6c2 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -937,8 +937,10 @@ int main(int argc, char *argv[])
"%s/.%s_ifstat.u%d", P_tmpdir, stats_type,
getuid());
- if (reset_history)
- unlink(hist_name);
+ if (reset_history && unlink(hist_name) < 0) {
+ perror("ifstat: unlink history file");
+ exit(-1);
+ }
if (!ignore_history || !no_update) {
struct stat stb;
Powered by blists - more mailing lists