5
0
mirror of git://git.proxmox.com/git/pve-zsync.git synced 2025-01-08 01:17:38 +03:00

Avoid 'no such file' error when no state exists.

This commit is contained in:
Wolfgang Bumiller 2015-09-28 11:40:03 +02:00 committed by Dietmar Maurer
parent 78d36df775
commit 21a673e6dd

View File

@ -6,6 +6,7 @@ use Data::Dumper qw(Dumper);
use Fcntl qw(:flock SEEK_END);
use Getopt::Long qw(GetOptionsFromArray);
use File::Copy qw(move);
use File::Path qw(make_path);
use Switch;
use JSON;
use IO::File;
@ -244,6 +245,7 @@ sub param_to_job {
sub read_state {
if (!-e $STATE) {
make_path $CONFIG_PATH;
my $new_fh = IO::File->new("> $STATE");
die "Could not create $STATE: $!\n" if !$new_fh;
print $new_fh "{}";