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 |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
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 --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;
v2: exit if unlink failed Signed-off-by: Denis Kirjanov <dkirjanov@suse.de> --- misc/ifstat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)