summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/data.c
diff options
context:
space:
mode:
authorAlexey Bayduraev <alexey.v.bayduraev@linux.intel.com>2022-02-22 12:14:17 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-02-22 21:15:56 -0300
commit65e7c963267f128df155f496a50933cea7dfa5b8 (patch)
tree4aad513312da1e3eb8b11bbabc92b2451892260c /tools/perf/util/data.c
parent859f7e45542aecaa77fde929232cbcf91b29e11d (diff)
downloadlinux-stable-65e7c963267f128df155f496a50933cea7dfa5b8.tar.gz
linux-stable-65e7c963267f128df155f496a50933cea7dfa5b8.tar.bz2
linux-stable-65e7c963267f128df155f496a50933cea7dfa5b8.zip
perf data: Adding error message if perf_data__create_dir() fails
Add proper return codes for all cases of data directory creation failure and add error message output based on these codes. Signed-off-by: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Antonov <alexander.antonov@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20220222091417.11020-1-alexey.v.bayduraev@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/data.c')
-rw-r--r--tools/perf/util/data.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index f5d260b1df4d..dc5d82ea1c30 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -52,12 +52,16 @@ int perf_data__create_dir(struct perf_data *data, int nr)
struct perf_data_file *file = &files[i];
ret = asprintf(&file->path, "%s/data.%d", data->path, i);
- if (ret < 0)
+ if (ret < 0) {
+ ret = -ENOMEM;
goto out_err;
+ }
ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
- if (ret < 0)
+ if (ret < 0) {
+ ret = -errno;
goto out_err;
+ }
file->fd = ret;
}