From c9c4e85881d877a0b29c6d7e9ab50345ebe87ca2 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 7 Mar 2007 17:05:51 -0800 Subject: [PATCH] * Use Cwd to make lockfiles into absolute filenames * Fix typo in lockfile * Export @cleanups to those things that munge it --- Debbugs/Common.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Debbugs/Common.pm b/Debbugs/Common.pm index 91b0259d..86f9abc8 100644 --- a/Debbugs/Common.pm +++ b/Debbugs/Common.pm @@ -35,7 +35,7 @@ BEGIN{ qw(getmaintainers_reverse) ], quit => [qw(quit)], - lock => [qw(filelock unfilelock)], + lock => [qw(filelock unfilelock @cleanups)], ); @EXPORT_OK = (); Exporter::export_ok_tags(qw(lock quit util)); @@ -47,6 +47,7 @@ use Debbugs::Config qw(:config); use IO::File; use Debbugs::MIME qw(decode_rfc1522); use Mail::Address; +use Cwd qw(cwd); use Fcntl qw(:flock); @@ -243,12 +244,15 @@ FLOCKs the passed file. Use unfilelock to unlock it. =cut my @filelocks; -my @cleanups; +our @cleanups; sub filelock { # NB - NOT COMPATIBLE WITH `with-lock' my ($lockfile) = @_; - my ($count,$errors) = @_; + if ($lockfile !~ m{^/}) { + $lockfile = cwd().'/'.$lockfile; + } + my ($count,$errors); $count= 10; $errors= ''; for (;;) { my $fh = eval { @@ -298,7 +302,7 @@ sub unfilelock { close($fl{fh}) or warn "Unable to close lockfile $fl{file}: $!"; unlink($fl{file}) - or warn "Unable to unlink locfile $fl{file}: $!"; + or warn "Unable to unlink lockfile $fl{file}: $!"; } -- 2.39.5