From: Tobias Ulmer Date: Tue, 10 Jul 2012 13:02:39 +0000 (+0200) Subject: Quote dir in e2lib.mkdir() X-Git-Tag: e2factory-2.3.12rc1~24 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=af15026e547e6762e91573e8309cd2e61a71171d;p=e2factory.git Quote dir in e2lib.mkdir() Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 24899ea..7d65d79 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1490,11 +1490,14 @@ end -- @return bool -- @return the last line ouf captured output function mkdir(dir, flags) - if not flags then - flags = "" - end - local args = string.format("%s %s", flags, dir) - return call_tool("mkdir", args) + flags = flags or "" + assert(type(dir) == "string") + assert(string.len(dir) > 0) + assert(type(flags) == "string") + + -- TODO: quote flags as well + local args = string.format("%s %s", flags, e2lib.shquote(dir)) + return call_tool("mkdir", args) end --- call the patch command