]> git.proxmox.com Git - pve-zsync.git/commitdiff
Avoid 'no such file' error when no state exists.
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 28 Sep 2015 09:40:03 +0000 (11:40 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 16 Oct 2015 08:59:59 +0000 (10:59 +0200)
pve-zsync

index 216057b6afbc2885273ae62ee9554e8a9f23d902..9de01d2de0cf34b2879009bdbd4a8f87b81db9c9 100644 (file)
--- a/pve-zsync
+++ b/pve-zsync
@@ -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 "{}";