]> git.karo-electronics.de Git - karo-tx-linux.git/commit
perf tools: Fix rm_rf() to handle non-regular files correctly
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 8 Jun 2016 09:29:11 +0000 (18:29 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 14 Jun 2016 12:29:54 +0000 (09:29 -0300)
commit2a1ef032cfccd8c92f32b86615a0b0151a7cd86f
tree16028ea560619381c524f0d6e29d80b53d5b4fc9
parent826424cc919529d6d234af12c6ba975b63528a74
perf tools: Fix rm_rf() to handle non-regular files correctly

Fix rm_rf() to handle non-regular files correctly. This fix includes two
changes;

 - Fix to use lstat(3) instead of stat(3) since if the target
   file is a symbolic link, rm_rf() should unlink the symbolic
   link itself, not the file which pointed by the symlink.
 - Fix to unlink non-regular files (except for directory),
   including symlink.

Even though the first one fixes to stat symlink itself, without second
fix, it still failed because the symlink is not a regular file.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160608092911.3116.90929.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/util.c