diff options
author | Ran Benita <ran@unusedvar.com> | 2020-07-25 15:49:17 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-07-25 15:59:23 +0300 |
commit | 0066e387bcf5e77411ff5edb4896df69c3df72cd (patch) | |
tree | e01c30b7f00ef655b571145c70fe1e545689b200 /tools/tools-common.c | |
parent | d67c9cfffbc356bbc6b8685c117e0b63cdfc059b (diff) | |
download | xorg-lib-libxkbcommon-0066e387bcf5e77411ff5edb4896df69c3df72cd.tar.gz |
tools: make independent from src/
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'tools/tools-common.c')
-rw-r--r-- | tools/tools-common.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/tools-common.c b/tools/tools-common.c index db17880..0c1ffb9 100644 --- a/tools/tools-common.c +++ b/tools/tools-common.c @@ -32,6 +32,7 @@ #include "config.h" +#include <errno.h> #include <limits.h> #include <fcntl.h> #include <stdlib.h> @@ -49,7 +50,6 @@ #include <termios.h> #endif -#include "utils.h" #include "tools-common.h" void @@ -212,6 +212,7 @@ tools_exec_command(const char *prefix, int real_argc, char **real_argv) char *argv[64] = {NULL}; char executable[PATH_MAX]; const char *command; + int rc; if (((size_t)real_argc >= ARRAY_SIZE(argv))) { fprintf(stderr, "Too many arguments\n"); @@ -220,8 +221,9 @@ tools_exec_command(const char *prefix, int real_argc, char **real_argv) command = real_argv[0]; - if (!snprintf_safe(executable, sizeof(executable), - "%s/%s-%s", LIBXKBCOMMON_TOOL_PATH, prefix, command)) { + rc = snprintf(executable, sizeof(executable), + "%s/%s-%s", LIBXKBCOMMON_TOOL_PATH, prefix, command); + if (rc < 0 || (size_t) rc >= sizeof(executable)) { fprintf(stderr, "Failed to assemble command\n"); return EXIT_FAILURE; } |