From 0066e387bcf5e77411ff5edb4896df69c3df72cd Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Jul 2020 15:49:17 +0300 Subject: tools: make independent from src/ Signed-off-by: Ran Benita --- tools/tools-common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tools/tools-common.c') 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 #include #include #include @@ -49,7 +50,6 @@ #include #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; } -- cgit v1.2.1