Merge remote-tracking branch 'iwlwifi-fixes/master' into iwlwifi-next
[firefly-linux-kernel-4.4.55.git] / tools / perf / util / data.c
index 29d720cf5844763f300611b85e503cc1e6013bf8..1921942fc2e035cb2ddec0ba94b066e02a8f5bc9 100644 (file)
@@ -50,12 +50,14 @@ static int open_file_read(struct perf_data_file *file)
 {
        struct stat st;
        int fd;
+       char sbuf[STRERR_BUFSIZE];
 
        fd = open(file->path, O_RDONLY);
        if (fd < 0) {
                int err = errno;
 
-               pr_err("failed to open %s: %s", file->path, strerror(err));
+               pr_err("failed to open %s: %s", file->path,
+                       strerror_r(err, sbuf, sizeof(sbuf)));
                if (err == ENOENT && !strcmp(file->path, "perf.data"))
                        pr_err("  (try 'perf record' first)");
                pr_err("\n");
@@ -88,6 +90,7 @@ static int open_file_read(struct perf_data_file *file)
 static int open_file_write(struct perf_data_file *file)
 {
        int fd;
+       char sbuf[STRERR_BUFSIZE];
 
        if (check_backup(file))
                return -1;
@@ -95,7 +98,8 @@ static int open_file_write(struct perf_data_file *file)
        fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR);
 
        if (fd < 0)
-               pr_err("failed to open %s : %s\n", file->path, strerror(errno));
+               pr_err("failed to open %s : %s\n", file->path,
+                       strerror_r(errno, sbuf, sizeof(sbuf)));
 
        return fd;
 }