Use a different path for the lock file
authorRené Jochum <r.jochum@proxmox.com>
Tue, 19 Jun 2018 14:59:54 +0000 (16:59 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 20 Jun 2018 04:42:49 +0000 (06:42 +0200)
This prevents lock_file from creating the config file with wrong permissions.

PVE/APIClient/Config.pm

index a4aa4c6..a783ab3 100644 (file)
@@ -67,7 +67,10 @@ sub config_filename {
 sub lock_config {
     my ($class, $timeout, $code, @param) = @_;
 
-    my $filename = $class->config_filename();
+    my $dir = PVE::APIClient::Helpers::configuration_directory();
+    make_path($dir);
+
+    my $filename = "$dir/.config.lck";
 
     my $res = PVE::APIClient::Tools::lock_file($filename, $timeout, $code, @param);