# HG changeset patch # User Kim Alvefur # Date 1450856522 -3600 # Node ID f436446661caf36b8e2fe558f6bb39c7ad4b7218 # Parent 6ab9c691c4c67ea9db88004bb7adab9b72001100 util.openssl: Move quoting and tostring call into escape function diff -r 6ab9c691c4c6 -r f436446661ca util/openssl.lua --- a/util/openssl.lua Wed Dec 23 08:39:22 2015 +0100 +++ b/util/openssl.lua Wed Dec 23 08:42:02 2015 +0100 @@ -144,7 +144,7 @@ do -- Lua to shell calls. local function shell_escape(s) - return s:gsub("'",[['\'']]); + return "'" .. tostring(s):gsub("'",[['\'']]) .. "'"; end local function serialize(f,o) @@ -153,12 +153,12 @@ if type(k) == "string" then t_insert(r, ("-%s"):format(k)); if v ~= true then - t_insert(r, ("'%s'"):format(shell_escape(tostring(v)))); + t_insert(r, shell_escape(v)); end end end for _,v in ipairs(o) do - t_insert(r, ("'%s'"):format(shell_escape(tostring(v)))); + t_insert(r, shell_escape(v)); end return t_concat(r, " "); end