perf report: fix owner error when reading perf.data
PATCH 1/1 perf report: fix owner error when reading perf.data
If perf.data file is owned by some user,
it can't be read even if current user is root. So, add a condition (if root) to skip the owner error handling if statement.
Signed-off-by Taeung Song <[email protected]>
--- tools/perf/util/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/data.c +1 -1
@@ -67,7 +67,7 @@ static int open_file_read(struct perf_data_file *file)if (fstat (fd, &st) <0 ) goto out_close; -if (!file->force && st.st_uid && (st.st_uid !=geteuid ())) { +if (!file->force &&geteuid () && st.st_uid && (st.st_uid !=geteuid ())) {pr_err ("File %s not owned by current user or root (use -f to override)\n" , file->path); goto out_close;
Signature · 1 line
1.9.1