Skip to contentSkip to conversation

perf report: fix owner error when reading perf.data

PATCH New Taeung Song 1 participant 1 message Sep 22, 2015 perf events

lore
Share & tools
lore
#0 lore raw

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.

---
 tools/perf/util/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/data.c +1 -1
index 1921942..20632a5 100644
@@ -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