summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian A. Weber2021-03-28 19:45:44 +0200
committerChristian A. Weber2021-03-28 19:45:44 +0200
commit72b1b2091eb784b3f24dc415d44e865a455948c8 (patch)
treedcb683b240214b785ecef01d072a1056dc42071e
parentac64ca1b5bd9e888b9af43bddaf8e2d8a4dd8dd7 (diff)
downloaditools-72b1b2091eb784b3f24dc415d44e865a455948c8.tar.gz
itools-72b1b2091eb784b3f24dc415d44e865a455948c8.tar.bz2
itools-72b1b2091eb784b3f24dc415d44e865a455948c8.zip
it::cdist() does nothing if no filenames are given, it::error() if filename=false
-rw-r--r--it.class8
1 files changed, 8 insertions, 0 deletions
diff --git a/it.class b/it.class
index 9dc1960..c219f19 100644
--- a/it.class
+++ b/it.class
@@ -753,6 +753,14 @@ static function cdist(...$args)
$files = array_merge((array)$files, (array)$arg);
}
+ # no files: return early, don't execute cdist -q ''
+ if (!is_array($files) || !count($files))
+ return true;
+
+ # Check for invalid file names
+ if (in_array(false, $files, true) || in_array(null, $files, true))
+ return it::error("invalid file name(s)");
+
return ($errs = it::exec('cdist -q {-opts} {files} 2>&1', ['-opts' => $opts, 'files' => $files])) ? it::error(['title' => $errs]) : true;
}