]> git.proxmox.com Git - pve-common.git/commitdiff
Output also lockname if it cannot be acquired
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 16 Dec 2015 09:38:20 +0000 (10:38 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 19 Dec 2015 08:05:00 +0000 (09:05 +0100)
If we can't acquire the lock in lock_file_full and get interrupted
by a signal inqeual to EINTR (e.g. SIGTERM), output also it's name
in the error message to allow better debugging.

Also fix a typo.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Tools.pm

index ae06c12b224b873dc7a27d5965078f54a8d9a851..64a57e9596dcbdcc15dff98d38161be38cbdf91e 100644 (file)
@@ -131,7 +131,7 @@ sub lock_file_full {
         }
 
         if (!flock ($lock_handles->{$$}->{$filename}, $mode|LOCK_NB)) {
         }
 
         if (!flock ($lock_handles->{$$}->{$filename}, $mode|LOCK_NB)) {
-            print STDERR "trying to aquire lock...";
+            print STDERR "trying to acquire lock...";
            my $success;
            while(1) {
                $success = flock($lock_handles->{$$}->{$filename}, $mode);
            my $success;
            while(1) {
                $success = flock($lock_handles->{$$}->{$filename}, $mode);
@@ -142,7 +142,7 @@ sub lock_file_full {
            }
             if (!$success) {
                 print STDERR " failed\n";
            }
             if (!$success) {
                 print STDERR " failed\n";
-                die "can't aquire lock - $!\n";
+                die "can't acquire lock '$filename' - $!\n";
             }
             print STDERR " OK\n";
         }
             }
             print STDERR " OK\n";
         }