mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-09 15:51:25 +00:00
Output also lockname if it cannot be acquired
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>
This commit is contained in:
parent
e4a1d8e240
commit
b148e99f3f
@ -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;
|
my $success;
|
||||||
while(1) {
|
while(1) {
|
||||||
$success = flock($lock_handles->{$$}->{$filename}, $mode);
|
$success = flock($lock_handles->{$$}->{$filename}, $mode);
|
||||||
@ -142,7 +142,7 @@ sub lock_file_full {
|
|||||||
}
|
}
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
print STDERR " failed\n";
|
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";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user