From acd3f0c781ccf96b74043183fcb9713f4e0beea2 Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Tue, 2 Mar 2010 18:00:07 +0100 Subject: [PATCH] bugfix: fix unintended recursion into non-directories searching for source/result configuration Signed-off-by: Gordon Hecker --- local/e2tool.lua | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/local/e2tool.lua b/local/e2tool.lua index de79191..cfc3be1 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -2525,11 +2525,14 @@ local function gather_result_paths(info, basedir, results) else tmp = dir end - if e2util.exists(resultconfig(tmp)) then - table.insert(results, tmp) - else - --try subfolder - gather_result_paths(info,tmp, results) + local s = e2util.stat(info.root .. "/" .. resultdir(tmp), false) + if s.type == "directory" then + if e2util.exists(resultconfig(tmp)) then + table.insert(results, tmp) + else + --try subfolder + gather_result_paths(info,tmp, results) + end end end return results @@ -2545,11 +2548,14 @@ local function gather_source_paths(info, basedir, sources) else tmp = dir end - if e2util.exists(sourceconfig(tmp)) then - table.insert(sources, tmp) - else - --try subfolder - gather_source_paths(info,tmp, sources) + local s = e2util.stat(info.root .. "/" .. sourcedir(tmp), false) + if s.type == "directory" then + if e2util.exists(sourceconfig(tmp)) then + table.insert(sources, tmp) + else + --try subfolder + gather_source_paths(info,tmp, sources) + end end end return sources -- 2.39.5