Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323732
b: refs/heads/master
c: e1aa7c3
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Aug 22, 2012
1 parent 73ce7bf commit 18878ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 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: 2f197b9d7eeaa723a80243610956fe4a17e7b5a4
refs/heads/master: e1aa7c30c599e99b4544f9e5b4c275c8a5325bdc
7 changes: 6 additions & 1 deletion trunk/tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4809,7 +4809,12 @@ int pevent_strerror(struct pevent *pevent, enum pevent_errno errnum,
const char *msg;

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

Expand Down
6 changes: 6 additions & 0 deletions trunk/tools/lib/traceevent/event-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ void __vdie(const char *fmt, ...);
void __vwarning(const char *fmt, ...);
void __vpr_stat(const char *fmt, ...);

#define min(x, y) ({ \
typeof(x) _min1 = (x); \
typeof(y) _min2 = (y); \
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })

static inline char *strim(char *string)
{
char *ret;
Expand Down

0 comments on commit 18878ec

Please sign in to comment.