Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320455
b: refs/heads/master
c: 4cc49d4
h: refs/heads/master
i:
  320453: 291f774
  320451: 2cce461
  320447: 41aadcf
v: v3
  • Loading branch information
Kirill A. Shutemov authored and Arnaldo Carvalho de Melo committed Jul 25, 2012
1 parent e185a19 commit ee8dea5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a841d650ea435c69e60675537f158a620697290
refs/heads/master: 4cc49d4dc82a39a542a31c1f51ead08a46fd33f1
4 changes: 2 additions & 2 deletions trunk/tools/perf/ui/browsers/hists.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,8 @@ static int hist_browser__dump(struct hist_browser *browser)
fp = fopen(filename, "w");
if (fp == NULL) {
char bf[64];
strerror_r(errno, bf, sizeof(bf));
ui_helpline__fpush("Couldn't write to %s: %s", filename, bf);
const char *err = strerror_r(errno, bf, sizeof(bf));
ui_helpline__fpush("Couldn't write to %s: %s", filename, err);
return -1;
}

Expand Down
11 changes: 10 additions & 1 deletion trunk/tools/perf/util/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,17 @@ int perf_target__strerror(struct perf_target *target, int errnum,
int idx;
const char *msg;

BUG_ON(buflen > 0);

if (errnum >= 0) {
strerror_r(errnum, buf, buflen);
const char *err = strerror_r(errnum, buf, buflen);

if (err != buf) {
size_t len = strlen(err);
char *c = mempcpy(buf, err, min(buflen - 1, len));
*c = '\0';
}

return 0;
}

Expand Down

0 comments on commit ee8dea5

Please sign in to comment.