From: Tobias Ulmer Date: Tue, 19 Nov 2013 18:21:59 +0000 (+0100) Subject: call_tool_argv(): No more shell string construction X-Git-Tag: e2factory-2.3.15rc1~370 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=057b6924681084e0b47721405bd0e141f935bcdf;p=e2factory.git call_tool_argv(): No more shell string construction Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index ccb3ff8..7d7fbf5 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1992,19 +1992,22 @@ function e2lib.call_tool_argv(tool, argv) return false, re end + cmd = { cmd } + flags, re = tools.get_tool_flags(tool) if not flags then return false, re end - call = string.format("%s %s", e2lib.shquote(cmd), flags) + for _,flag in ipairs(flags) do + table.insert(cmd, flag) + end for _,arg in ipairs(argv) do - assert(type(arg) == "string") - call = call .. " " .. e2lib.shquote(arg) + table.insert(cmd, arg) end - rc, re = e2lib.callcmd_log(call) + rc, re = e2lib.callcmd_log(cmd) if not rc or rc ~= 0 then return false, re end