From: Dietmar Maurer Date: Tue, 20 Aug 2013 07:34:55 +0000 (+0200) Subject: check if mkdir return EEXIST X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=62613060520fb9cdb817c2f74acfe61856b1c132;p=pve-cluster.git check if mkdir return EEXIST Seems -d $dir is not really reliable on cluster file system (cache?). Signed-off-by: Dietmar Maurer --- diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm index 6054277..82301ac 100644 --- a/data/PVE/Cluster.pm +++ b/data/PVE/Cluster.pm @@ -1,7 +1,7 @@ package PVE::Cluster; use strict; -use POSIX; +use POSIX qw(EEXIST); use File::stat qw(); use Socket; use Storable qw(dclone); @@ -130,7 +130,7 @@ sub gen_local_dirs { foreach my $dir (@required_dirs) { if (! -d $dir) { - mkdir($dir) || die "unable to create directory '$dir' - $!\n"; + mkdir($dir) || $! == EEXIST || die "unable to create directory '$dir' - $!\n"; } } } @@ -141,7 +141,7 @@ sub gen_auth_key { check_cfs_is_mounted(); - -d $authdir || mkdir $authdir || die "unable to create dir '$authdir' - $!\n"; + mkdir $authdir || $! == EEXIST || die "unable to create dir '$authdir' - $!\n"; my $cmd = "openssl genrsa -out '$authprivkeyfn' 2048"; run_silent_cmd($cmd);