summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-08-01 10:09:08 +0000
committerFrancois Pons <fpons@mandriva.com>2003-08-01 10:09:08 +0000
commit3e5df3f7bcbeda66357b2e99c19a6000807ea1d6 (patch)
treec2c10ab33117cb16d15558e4da4c569c46d2912c /urpm.pm
parent3c0e1c64926fed71519e6779c57428fd730a590a (diff)
downloadurpmi-3e5df3f7bcbeda66357b2e99c19a6000807ea1d6.tar
urpmi-3e5df3f7bcbeda66357b2e99c19a6000807ea1d6.tar.gz
urpmi-3e5df3f7bcbeda66357b2e99c19a6000807ea1d6.tar.bz2
urpmi-3e5df3f7bcbeda66357b2e99c19a6000807ea1d6.tar.xz
urpmi-3e5df3f7bcbeda66357b2e99c19a6000807ea1d6.zip
create shared file if needed, remove the lock file when unlock the database.
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/urpm.pm b/urpm.pm
index c612a0a8..754daf78 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2484,6 +2484,11 @@ sub shlock_urpmi_db {
#- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
my ($LOCK_SH, $LOCK_NB) = (1, 4);
+ #- create the .LOCK file if needed.
+ unless (-e "$urpm->{statedir}/.LOCK") {
+ open LOCK_FILE, ">$urpm->{statedir}/.LOCK";
+ close LOCK_FILE;
+ }
#- lock urpmi database, but keep lock to wait for an urpmi.update to finish.
open LOCK_FILE, "$urpm->{statedir}/.LOCK";
flock LOCK_FILE, $LOCK_SH|$LOCK_NB or $urpm->{fatal}(7, N("urpmi database locked"));
@@ -2501,6 +2506,7 @@ sub unlock_urpmi_db {
flock LOCK_FILE, $LOCK_UN;
close LOCK_FILE;
+ unlink "$urpm->{statedir}/.LOCK";
}
sub copy_packages_of_removable_media {