Commit 1ad97601 authored by Gavin Brown's avatar Gavin Brown

use File::Copy and die if the move failed

parent f27e1260
......@@ -3,6 +3,7 @@
# redistribute it and/or modify it under the same terms as Perl itself.
use Config::Simple;
use File::Basename qw(basename);
use File::Copy qw(move);
use File::Temp qw(tempfile);
use Getopt::Long;
use JSON qw(encode_json);
......@@ -170,8 +171,9 @@ sub process_packet {
$fh->print(encode_json($stats));
$fh->close;
my $dest = $config->{'dsd.directory'}.'/'.basename($file);
if (!rename($file, $dest)) {
if (!move($file, $dest)) {
syslog(LOG_CRIT, "error renaming $file to $dest: $!");
exit(1);
} else {
init_stats();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment