Преглед изворни кода

Minor validation added to install subs

Andy Baugh пре 8 година
родитељ
комит
05d32ce4fc
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      bin/install

+ 2 - 0
bin/install

@@ -91,6 +91,7 @@ function get_string_from_stdin($noecho=0) {
 }
 
 function install( $to, $from, $files2copy ) {
+    if( empty($to), empty($from) || empty($files2copy) ) die("Bad arguments passed to 'install' function");
     if( file_exists( $to ) && !is_dir( $to ) ) {
         echo "[FATAL] $to already exists but is not a directory! Stopping here.\n";
         exit(1);
@@ -108,6 +109,7 @@ function install( $to, $from, $files2copy ) {
 }
 
 function ensure_directories_exist( $dirs ) {
+    if( empty( $dirs ) ) die("Bad arguments passed to 'ensure_directories_exist' function");
     foreach ( $dirs as $dir ) {
         if ( !file_exists( $dir ) ) {
             echo "exec `/bin/mkdir '$dir'`\n";