diff mbox series

[iproute2,v2] ifstat: handle unlink return value

Message ID 20240229122210.2478-1-dkirjanov@suse.de (mailing list archive)
State Superseded
Delegated to: David Ahern
Headers show
Series [iproute2,v2] 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:22 p.m. UTC
v2: exit if unlink failed
Signed-off-by: Denis Kirjanov <dkirjanov@suse.de>
---
 misc/ifstat.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Denis Kirjanov Feb. 29, 2024, 12:26 p.m. UTC | #1
On 2/29/24 15:22, Denis Kirjanov wrote:
> v2: exit if unlink failed

please ignore

> Signed-off-by: Denis Kirjanov <dkirjanov@suse.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;
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;