[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240221120424.3221-1-dkirjanov@suse.de>
Date: Wed, 21 Feb 2024 07:04:24 -0500
From: Denis Kirjanov <kirjanov@...il.com>
To: stephen@...workplumber.org
Cc: netdev@...r.kernel.org,
Denis Kirjanov <dkirjanov@...e.de>
Subject: [PATCH iproute2] ifstat: handle unlink return value
Print an error message if we can't remove the history file
Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
---
misc/ifstat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 18171a2c..5dede111 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -938,7 +938,9 @@ int main(int argc, char *argv[])
getuid());
if (reset_history)
- unlink(hist_name);
+ if (unlink(hist_name) < 0)
+ fprintf(stderr, "Cannot remove history file \"%s\": %s\n",
+ hist_name, strerror(errno));
if (!ignore_history || !no_update) {
struct stat stb;
--
2.30.2
Powered by blists - more mailing lists