Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools lib subcmd: 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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-bozcszy93tpgw9ad6qm3dhpx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+8 -2
+3 -2
tools/lib/subcmd/run-command.c
··· 3 3 #include <sys/stat.h> 4 4 #include <fcntl.h> 5 5 #include <string.h> 6 + #include <linux/string.h> 6 7 #include <errno.h> 7 8 #include <sys/wait.h> 8 9 #include "subcmd-util.h" ··· 110 109 111 110 if (cmd->dir && chdir(cmd->dir)) 112 111 die("exec %s: cd to %s failed (%s)", cmd->argv[0], 113 - cmd->dir, strerror_r(errno, sbuf, sizeof(sbuf))); 112 + cmd->dir, str_error_r(errno, sbuf, sizeof(sbuf))); 114 113 if (cmd->env) { 115 114 for (; *cmd->env; cmd->env++) { 116 115 if (strchr(*cmd->env, '=')) ··· 174 173 if (errno == EINTR) 175 174 continue; 176 175 fprintf(stderr, " Error: waitpid failed (%s)", 177 - strerror_r(errno, sbuf, sizeof(sbuf))); 176 + str_error_r(errno, sbuf, sizeof(sbuf))); 178 177 return -ERR_RUN_COMMAND_WAITPID; 179 178 } 180 179 if (waiting != pid)
+5
tools/objtool/Build
··· 5 5 objtool-y += objtool.o 6 6 7 7 objtool-y += libstring.o 8 + objtool-y += str_error_r.o 8 9 9 10 CFLAGS += -I$(srctree)/tools/lib 10 11 11 12 $(OUTPUT)libstring.o: ../lib/string.c FORCE 13 + $(call rule_mkdir) 14 + $(call if_changed_dep,cc_o_c) 15 + 16 + $(OUTPUT)str_error_r.o: ../lib/str_error_r.c FORCE 12 17 $(call rule_mkdir) 13 18 $(call if_changed_dep,cc_o_c)