lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 Feb 2019 14:38:53 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc:     Jiri Olsa <jolsa@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 01/14] perf tools: Make rm_rf to remove single file

On Tue, Feb 05, 2019 at 02:33:06PM +0300, Alexey Budankov wrote:
> 
> On 03.02.2019 18:30, Jiri Olsa wrote:
> > Let rm_rf remove file if it's provided by path.
> > 
> > Link: http://lkml.kernel.org/n/tip-whhp3ej5795l9dc86xfyyp74@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > ---
> >  tools/perf/util/util.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> > index 320b0fef249a..58b8d6a8bfbc 100644
> > --- a/tools/perf/util/util.c
> > +++ b/tools/perf/util/util.c
> > @@ -125,8 +125,14 @@ int rm_rf(const char *path)
> >  	char namebuf[PATH_MAX];
> >  
> >  	dir = opendir(path);
> > -	if (dir == NULL)
> > -		return 0;
> > +	if (dir == NULL) {
> > +		/*
> > +		 * The path does not exist or is not directory,
> > +		 * so there's no harm to try remove it. This way
> > +		 * rm_rf will work over single file.
> > +		 */
> 
> This can also happen due to lack of fds or memory.
> Not sure file still has to be deleted in these cases.

ok, will do proper error check

thanks,
jirka

> 
> - Alexey
> 
> > +		return unlink(path);
> > +	}
> >  
> >  	while ((d = readdir(dir)) != NULL && !ret) {
> >  		struct stat statbuf;
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ