summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-07-31 16:29:12 +0000
committerFrancois Pons <fpons@mandriva.com>2003-07-31 16:29:12 +0000
commite8ab23bf4647a6dd9c9606fa805a35e3ccf00c2b (patch)
treec0879a228412e82167124bb547bae98655615412
parent66dab7f710a2057a3b80774e43c596affa7f6701 (diff)
downloadurpmi-e8ab23bf4647a6dd9c9606fa805a35e3ccf00c2b.tar
urpmi-e8ab23bf4647a6dd9c9606fa805a35e3ccf00c2b.tar.gz
urpmi-e8ab23bf4647a6dd9c9606fa805a35e3ccf00c2b.tar.bz2
urpmi-e8ab23bf4647a6dd9c9606fa805a35e3ccf00c2b.tar.xz
urpmi-e8ab23bf4647a6dd9c9606fa805a35e3ccf00c2b.zip
added urpm::shlock_urpmi_db to shared lock on urpmi db (used by urpmi, urpmq and
urpmf).
-rw-r--r--urpm.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/urpm.pm b/urpm.pm
index 8ca2705b..636a1d06 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2478,7 +2478,16 @@ sub exlock_urpmi_db {
open LOCK_FILE, ">$urpm->{statedir}/.LOCK";
flock LOCK_FILE, $LOCK_EX|$LOCK_NB or $urpm->{fatal}(7, N("urpmi database locked"));
}
+sub shlock_urpmi_db {
+ my ($urpm) = @_;
+
+ #- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
+ my $LOCK_EX = 2;
+ #- lock urpmi database, but keep lock to wait for an urpmi.update to finish.
+ open LOCK_FILE, ">$urpm->{statedir}/.LOCK";
+ flock LOCK_FILE, $LOCK_EX or $urpm->{fatal}(7, N("urpmi database locked"));
+}
sub unlock_urpmi_db {
my ($_urpm) = @_;