]> git.e2factory.org Git - e2factory.git/commitdiff
call_tool_argv(): No more shell string construction
authorTobias Ulmer <tu@emlix.com>
Tue, 19 Nov 2013 18:21:59 +0000 (19:21 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index ccb3ff8ae20a6a5c1e197259c0b96e0238fc201e..7d7fbf5d906cde3093be72829fafa2d232ff19b6 100644 (file)
@@ -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