[pve-devel] [PATCH pve-common 2/2] Output also lockname if it cannot be acquired

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Dec 16 10:38:20 CET 2015


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 at proxmox.com>
---
 src/PVE/Tools.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index ae06c12..64a57e9 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -131,7 +131,7 @@ sub lock_file_full {
         }
 
         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);
@@ -142,7 +142,7 @@ sub lock_file_full {
 	    }
             if (!$success) {
                 print STDERR " failed\n";
-                die "can't aquire lock - $!\n";
+                die "can't acquire lock '$filename' - $!\n";
             }
             print STDERR " OK\n";
         }
-- 
2.1.4





More information about the pve-devel mailing list