diff mbox series

[iproute2,v3] ifstat: handle unlink return value

Message ID 20240229122634.2619-1-dkirjanov@suse.de (mailing list archive)
State Accepted
Commit 67685422bfee1b886b907e03129b12c8a1ebb6a4
Delegated to: Stephen Hemminger
Headers show
Series [iproute2,v3] ifstat: handle unlink return value | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Denis Kirjanov Feb. 29, 2024, 12:26 p.m. UTC
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>
---
 misc/ifstat.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 4, 2024, 1:20 a.m. UTC | #1
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Thu, 29 Feb 2024 07:26:34 -0500 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [iproute2,v3] ifstat: handle unlink return value
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=67685422bfee

You are awesome, thank you!
diff mbox series

Patch

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;