Update of /cvsroot/fink/pdb
In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv24188

Modified Files:
        create-finkdb.pl 
Log Message:
flock so there can only be one copy running at a time

Index: create-finkdb.pl
===================================================================
RCS file: /cvsroot/fink/pdb/create-finkdb.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- create-finkdb.pl    3 Dec 2007 19:17:32 -0000       1.15
+++ create-finkdb.pl    3 Dec 2007 19:22:17 -0000       1.16
@@ -46,6 +46,7 @@
 ### now load the useful modules
 
 use lib qw(fink/perlmod);
+use Fcntl qw(:DEFAULT :flock);
 use Fink::Services qw(&read_config &latest_version);
 use Fink::Config qw(&set_options);
 use Fink::Package;
@@ -126,6 +127,12 @@
 
 &die_with_usage if $wanthelp;
 
+mkpath($tempdir);
+open(LOCKFILE, '>>' . $tempdir . '/create-finkdb.lock') or die "could not open 
lockfile for append: $!";
+if (not flock(LOCKFILE, LOCK_EX | LOCK_NB)) {
+       die "Another process is running.";
+}
+
 # get the list of distributions to scan
 {
        my $distributions;


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to