summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}