package PVE::Tools;
use strict;
-use POSIX;
+use POSIX qw(EINTR);
use IO::Socket::INET;
use IO::Select;
use File::Basename;
if (!flock ($lock_handles->{$$}->{$filename}, LOCK_EX|LOCK_NB)) {
print STDERR "trying to aquire lock...";
- if (!flock ($lock_handles->{$$}->{$filename}, LOCK_EX)) {
+ my $success;
+ while(1) {
+ $success = flock($lock_handles->{$$}->{$filename}, LOCK_EX);
+ # try again on EINTR (see bug #273)
+ if ($success || ($! != EINTR)) {
+ last;
+ }
+ }
+ if (!$success) {
print STDERR " failed\n";
die "can't aquire lock - $!\n";
}
+libpve-common-perl (1.0-38) unstable; urgency=low
+
+ * fix bug #273: retry flock if it fails with EINTR
+
+ -- Proxmox Support Team <support@proxmox.com> Wed, 31 Oct 2012 08:21:43 +0100
+
libpve-common-perl (1.0-37) unstable; urgency=low
* fix bug #264: use option pipefail for shell commands