From 590acdc5294eb12259b0112b230418faab575edb Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 21 Nov 2016 14:36:04 +1100 Subject: [PATCH] ctdb-tool: Allow passing multiple command-line arguments to helper Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/tools/ctdb.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 5f172effcb6..dffc103dbe1 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -645,21 +645,36 @@ static int str_to_data(const char *str, size_t len, TALLOC_CTX *mem_ctx, return ret; } -static int run_helper(const char *command, const char *path, const char *arg1) +static int run_helper(TALLOC_CTX *mem_ctx, const char *command, + const char *path, int argc, const char **argv) { pid_t pid; int save_errno, status, ret; + const char **new_argv; + int i; + + new_argv = talloc_array(mem_ctx, const char *, argc + 2); + if (new_argv == NULL) { + return ENOMEM; + } + + new_argv[0] = path; + for (i=0; i