[pve-devel] [PATCH pve-client 1/2] Lock the config file in /var/lock

Dietmar Maurer dietmar at proxmox.com
Tue Jun 19 16:41:44 CEST 2018


comments inline:

> On June 19, 2018 at 4:03 PM René Jochum <r.jochum at proxmox.com> wrote:
> 
> 
> this prevents it from beeing created by the "lock_file" function.
> It would get 0644 permissions when the file is created by "lock_file".
> ---
>  PVE/APIClient/Config.pm | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/APIClient/Config.pm b/PVE/APIClient/Config.pm
> index a4aa4c6..6f9f332 100644
> --- a/PVE/APIClient/Config.pm
> +++ b/PVE/APIClient/Config.pm
> @@ -64,10 +64,18 @@ sub config_filename {
>      return "$dir/config";
>  }
>  

my $lock_directory = "/var/lock/pveclient";

> +sub config_lock_filename {
> +    my ($class) = @_;
> +
> +    return "/var/lock/pveclient/config.lck";

my $config_lock_filename = "${lock_directory}/config.lck";

> +}
> +
>  sub lock_config {
>      my ($class, $timeout, $code, @param) = @_;
>  
> -    my $filename = $class->config_filename();
> +    my $filename = $class->config_lock_filename();
> +
> +    make_path(dirname($filename));

make_path($lock_directory);
...




More information about the pve-devel mailing list