[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240229122210.2478-1-dkirjanov@suse.de>
Date: Thu, 29 Feb 2024 07:22:09 -0500
From: Denis Kirjanov <kirjanov@...il.com>
To: stephen@...workplumber.org
Cc: netdev@...r.kernel.org,
Denis Kirjanov <dkirjanov@...e.de>
Subject: [PATCH iproute2 v2] ifstat: handle unlink return value
v2: exit if unlink failed
Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
---
misc/ifstat.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 767cedd4..72901097 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;
--
2.30.2
Powered by blists - more mailing lists