if ($output eq "-") {
$output_fh = *STDOUT;
} else {
- if (not open($output_fh, ">", $output)) {
- error(4, "%s: %s\n", $output, $!);
+ if (not open($output_fh, ">", $output . "~")) {
+ error(4, "%s: %s\n", $output . "~", $!);
}
}
if ($output ne "-") {
close($output_fh);
}
+
+ if (not rename($output . "~", $output)) {
+ error(4, "%s: %s\n", $output, $!);
+ }
}
main();