aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kirjanov <kirjanov@gmail.com>2024-02-29 07:26:34 -0500
committerStephen Hemminger <stephen@networkplumber.org>2024-03-03 17:12:11 -0800
commit67685422bfee1b886b907e03129b12c8a1ebb6a4 (patch)
treecfc1b89348493b23ab9cf6c20d8963ad26b59b86
parent68eef949c29e02261063de641762e37fda7193d3 (diff)
downloadiproute2-next-67685422bfee1b886b907e03129b12c8a1ebb6a4.tar.gz
ifstat: handle unlink return value
Print an error message if we can't remove the history file v2: exit if unlink failed v3: restore the changelog Signed-off-by: Denis Kirjanov <dkirjanov@suse.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--misc/ifstat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 767cedd4a..72901097e 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;