Close input and output file handles.
[ssic.git] / src / ssic.pl
index d678556be7716789249ad70d4c540e31f266ad71..5cc04efe502647737ace0cb520e4a5f0af852739 100644 (file)
@@ -111,7 +111,7 @@ sub compile
        my $var_name;
        my $var_value;
 
-       if ($input eq $output) {
+       if ($input eq $output and $input ne "-") {
                error(4, "Input and output files are equal\n");
        }
 
@@ -152,6 +152,13 @@ sub compile
        }
 
        print($output_fh $ssi->process(<$input_fh>));
+
+       if ($input ne "-") {
+               close($input_fh);
+       }
+       if ($output ne "-") {
+               close($output_fh);
+       }
 }
 
 main();