diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-08 14:26:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-12 14:20:30 -0400 |
commit | 07eebccbca2c21f32b5142f1a55b3b6818c54116 (patch) | |
tree | 320d0ddad6e4aa26c7e9f324c5109333dee35562 /tools/lib/subcmd/run-command.c | |
parent | 61a6445e463a3152590352d8634131955f531c6e (diff) |
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>
Diffstat (limited to 'tools/lib/subcmd/run-command.c')
-rw-r--r-- | tools/lib/subcmd/run-command.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/subcmd/run-command.c b/tools/lib/subcmd/run-command.c index f4f6c9eb8e59..911f83942723 100644 --- a/tools/lib/subcmd/run-command.c +++ b/tools/lib/subcmd/run-command.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <sys/stat.h> | 3 | #include <sys/stat.h> |
4 | #include <fcntl.h> | 4 | #include <fcntl.h> |
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <linux/string.h> | ||
6 | #include <errno.h> | 7 | #include <errno.h> |
7 | #include <sys/wait.h> | 8 | #include <sys/wait.h> |
8 | #include "subcmd-util.h" | 9 | #include "subcmd-util.h" |
@@ -109,7 +110,7 @@ int start_command(struct child_process *cmd) | |||
109 | 110 | ||
110 | if (cmd->dir && chdir(cmd->dir)) | 111 | if (cmd->dir && chdir(cmd->dir)) |
111 | die("exec %s: cd to %s failed (%s)", cmd->argv[0], | 112 | die("exec %s: cd to %s failed (%s)", cmd->argv[0], |
112 | cmd->dir, strerror_r(errno, sbuf, sizeof(sbuf))); | 113 | cmd->dir, str_error_r(errno, sbuf, sizeof(sbuf))); |
113 | if (cmd->env) { | 114 | if (cmd->env) { |
114 | for (; *cmd->env; cmd->env++) { | 115 | for (; *cmd->env; cmd->env++) { |
115 | if (strchr(*cmd->env, '=')) | 116 | if (strchr(*cmd->env, '=')) |
@@ -173,7 +174,7 @@ static int wait_or_whine(pid_t pid) | |||
173 | if (errno == EINTR) | 174 | if (errno == EINTR) |
174 | continue; | 175 | continue; |
175 | fprintf(stderr, " Error: waitpid failed (%s)", | 176 | fprintf(stderr, " Error: waitpid failed (%s)", |
176 | strerror_r(errno, sbuf, sizeof(sbuf))); | 177 | str_error_r(errno, sbuf, sizeof(sbuf))); |
177 | return -ERR_RUN_COMMAND_WAITPID; | 178 | return -ERR_RUN_COMMAND_WAITPID; |
178 | } | 179 | } |
179 | if (waiting != pid) | 180 | if (waiting != pid) |