mkdir $d; # 0777
}
}
- open(my $outfile, ">", "$filename");
- binmode $outfile; # for crapage systems, use binary
- if($fileattr{'nonewline'}) {
- # cut off the final newline
- chomp($fileContent);
- }
- print $outfile $fileContent;
- close($outfile);
+ if (open(my $outfile, ">", "$filename")) {
+ binmode $outfile; # for crapage systems, use binary
+ if($fileattr{'nonewline'}) {
+ # cut off the final newline
+ chomp($fileContent);
+ }
+ print $outfile $fileContent;
+ close($outfile);
+ } else {
+ logmsg "ERROR: cannot write $filename\n";
+ }
}
}
return ($why, 0);