mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
tools lib traceevent: Use str_error_r()
To make it portable to non-glibc systems, that follow the XSI variant instead of the GNU specific one that gets in place when _GNU_SOURCE is defined. Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
d0761e37fe
commit
c3cec9e68f
1 changed files with 2 additions and 6 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
#include <netinet/ip6.h>
|
||||
#include "event-parse.h"
|
||||
|
|
@ -6131,12 +6132,7 @@ int pevent_strerror(struct pevent *pevent __maybe_unused,
|
|||
const char *msg;
|
||||
|
||||
if (errnum >= 0) {
|
||||
msg = strerror_r(errnum, buf, buflen);
|
||||
if (msg != buf) {
|
||||
size_t len = strlen(msg);
|
||||
memcpy(buf, msg, min(buflen - 1, len));
|
||||
*(buf + min(buflen - 1, len)) = '\0';
|
||||
}
|
||||
str_error_r(errnum, buf, buflen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue