INN commit: branches/2.5 (16 files)

INN Commit rra at isc.org
Thu Aug 4 22:10:47 UTC 2011


    Date: Thursday, August 4, 2011 @ 15:10:47
  Author: iulius
Revision: 9304

add an INN::Utils::Shlock module to wrap shlock in Perl scripts

Calling shlock (a program shipped with INN) is more portable than using 
flock(2) and its corresponding Perl function because this function does
not work as expected on all existing systems (for instance on Solaris).

This patch:

* contains POD documentation for INN::Utils::Shlock;

* adds support for INN::Utils::Shlock instead of flock(2) in pullnews 
and mailpost.

* uses INN::Utils::Shlock instead of a subfunction calling shlock(1)
in controlchan, thdexpire and send-uucp.

Thanks to Dennis Davis for the bug report.

Added:
  branches/2.5/perl/INN/Utils/
Modified:
  branches/2.5/CONTRIBUTORS
  branches/2.5/MANIFEST
  branches/2.5/backends/send-uucp.in
  branches/2.5/contrib/thdexpire.in
  branches/2.5/control/controlchan.in
  branches/2.5/control/modules/newgroup.pl
  branches/2.5/control/modules/rmgroup.pl
  branches/2.5/doc/man/	(properties)
  branches/2.5/doc/man/Makefile
  branches/2.5/doc/pod/news.pod
  branches/2.5/doc/pod/shlock.pod
  branches/2.5/frontends/mailpost.in
  branches/2.5/frontends/pullnews.in
  branches/2.5/perl/Makefile
  branches/2.5/support/mkmanifest

-----------------------------+
 CONTRIBUTORS                |    2 +-
 MANIFEST                    |    3 +++
 backends/send-uucp.in       |   36 ++++++++++--------------------------
 contrib/thdexpire.in        |   13 ++++++++++---
 control/controlchan.in      |   33 +++++++--------------------------
 control/modules/newgroup.pl |   11 +++++++++--
 control/modules/rmgroup.pl  |   10 ++++++++--
 doc/man/Makefile            |    4 +++-
 doc/pod/news.pod            |    9 +++++++++
 doc/pod/shlock.pod          |    7 +++++++
 frontends/mailpost.in       |   41 ++++++++++-------------------------------
 frontends/pullnews.in       |   21 ++++++---------------
 perl/Makefile               |   16 +++++++++++++---
 support/mkmanifest          |    1 +
 14 files changed, 97 insertions(+), 110 deletions(-)

Modified: CONTRIBUTORS
===================================================================
--- CONTRIBUTORS	2011-08-04 22:09:57 UTC (rev 9303)
+++ CONTRIBUTORS	2011-08-04 22:10:47 UTC (rev 9304)
@@ -274,4 +274,4 @@
 S.P. Zeidler, Nix, Florian Schlichting, Torsten Jerzembeck, Harald Dunkel,
 Lars Magne Ingebrigtsen, Sam Varshavchik, Matthew Vernon, Ian Jackson,
 Edmund H. Ramm, Raphael Barrois, Bo Lindbergh, Matthias Meyser,
-Dennis Preiser, Paolo Amoroso
+Dennis Preiser, Paolo Amoroso, Dennis Davis

Modified: MANIFEST
===================================================================
--- MANIFEST	2011-08-04 22:09:57 UTC (rev 9303)
+++ MANIFEST	2011-08-04 22:10:47 UTC (rev 9304)
@@ -115,6 +115,7 @@
 doc/hook-python                       Python hook notes
 doc/man                               nroff documentation (Directory)
 doc/man/INN__Config.3pm               Manpage for INN::Config Perl module
+doc/man/INN__Utils__Shlock.3pm        Manpage for INN::Utils::Shlock Perl module
 doc/man/Makefile                      Makefile for nroff documentation
 doc/man/active.5                      Manpage for active database
 doc/man/active.times.5                Manpage for active.times file
@@ -605,6 +606,8 @@
 perl                                  Perl libraries (Directory)
 perl/INN                              INN Perl modules (Directory)
 perl/INN/Config.pm.in                 INN::Config module
+perl/INN/Utils                        INN::Utils Perl modules (Directory)
+perl/INN/Utils/Shlock.pm.in           INN::Utils::Shlock module
 perl/Makefile                         Makefile for perl libraries
 samples                               Prototype INN config files (Directory)
 samples/INN.py                        Stub Python functions

Modified: backends/send-uucp.in
===================================================================
--- backends/send-uucp.in	2011-08-04 22:09:57 UTC (rev 9303)
+++ backends/send-uucp.in	2011-08-04 22:10:47 UTC (rev 9304)
@@ -19,6 +19,7 @@
 ##############################################################################
 
 use strict;
+use INN::Utils::Shlock;
 
 # for compatibility with earlier versions of INN
 $INN::Config::pathetc ||= '/etc/news';
@@ -75,10 +76,14 @@
 
 chdir $INN::Config::batch or logdie("Can't access $INN::Config::batch: $!", 'crit');
 
-shlock($lockfile);
+# Acquire a lock.
+INN::Utils::Shlock::lock($lockfile, 60) or logdie("cannot create lockfile $lockfile");
 
 run_site($_) foreach @sitelist;
-unlink $lockfile;
+
+# Unlock.
+INN::Utils::Shlock::unlock($lockfile) or mailArtAndDie ("cannot unlock $lockfile");
+
 exit 0;
 
 ##############################################################################
@@ -224,7 +229,9 @@
     my ($msg, $lvl) = @_;
 
     logmsg($msg, $lvl || 'err');
-    unlink $lockfile;
+
+    # Unlock.
+    INN::Utils::Shlock::unlock($lockfile);
     exit 1;
 }
 
@@ -236,29 +243,6 @@
     logdie('ctlinnd returned status ' . ($st & 255)) if $st > 0;
 }
 
-sub shlock {
-    my $lockfile = shift;
-
-    my $locktry = 0;
-    while ($locktry < 60) {
-        if (system("$INN::Config::newsbin/shlock", '-p', $$, '-f', $lockfile) == 0) {
-            return 1;
-        }
-        $locktry++;
-        sleep 2;
-    }
-
-    my $lockreason;
-    if (open(LOCKFILE, $lockfile)) {
-        $lockreason = 'held by ' . (<LOCKFILE> || '?');
-        close LOCKFILE;
-    } else {
-        $lockreason = $!;
-    }
-    logdie("Cannot get lock $lockfile: $lockreason");
-    return undef;
-}
-
 __END__
 
 =head1 NAME

Modified: contrib/thdexpire.in
===================================================================
--- contrib/thdexpire.in	2011-08-04 22:09:57 UTC (rev 9303)
+++ contrib/thdexpire.in	2011-08-04 22:10:47 UTC (rev 9304)
@@ -6,6 +6,7 @@
 use POSIX ":fcntl_h";
 use SDBM_File;
 use Getopt::Std;
+use INN::Utils::Shlock;
 
 # With the -M switch this program installs its own man page.
 #-----------------------------------------------------------------------------
@@ -245,6 +246,8 @@
 
 #-----------------------------------------------------------------------------
 
+my $lockfile = "$INN::Config::innddir/thdexpire.pid";
+
 chdir $INN::Config::spool || die "chdir $INN::Config::spool: $!";
 $opt_r=0;      # make a report
 $opt_t=30;     # check interval in minutes
@@ -275,8 +278,9 @@
     exit 0;
 }
 
-(system "$INN::Config::newsbin/shlock", "-p", $$, "-f", "$INN::Config::innddir/thdexpire.pid")>>8==0
-  || die "Already running";
+# Acquire a lock.
+INN::Utils::Shlock::lock($lockfile, 5) or die ("cannot create lockfile $lockfile");
+
 tie(%S, SDBM_File, $sfile, O_RDWR|O_CREAT, 0664) || die "open $sfile: $!";
 $SIG{'TERM'}=$SIG{'INT'}='finish';
 $|=1;
@@ -641,7 +645,10 @@
 sub finish
 {
     untie(%S);
-    unlink "$INN::Config::innddir/thdexpire.pid";
+
+    # Unlock.
+    INN::Utils::Shlock::unlock($lockfile);
+
     exit 0;
 }
 #-----------------------------------------------------------------------------

Modified: control/controlchan.in
===================================================================
--- control/controlchan.in	2011-08-04 22:09:57 UTC (rev 9303)
+++ control/controlchan.in	2011-08-04 22:10:47 UTC (rev 9304)
@@ -33,6 +33,7 @@
 use Encode;
 use Getopt::Std;
 use MIME::Parser;
+use INN::Utils::Shlock;
 use strict;
 
 delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
@@ -489,7 +490,8 @@
     my $lockfile = $logfile;
     $lockfile =~ s#.*/##;
     $lockfile = "$INN::Config::locks/LOCK.$lockfile";
-    shlock($lockfile);
+    # Acquire a lock.
+    INN::Utils::Shlock::lock($lockfile, 60) or logdie("Cannot create lockfile $lockfile");
 
     open(LOGFILE, ">>$logfile") or logdie("Cannot open $logfile: $!");
     print LOGFILE "$message\n";
@@ -497,7 +499,9 @@
         print LOGFILE "    $_\n";
     }
     close LOGFILE;
-    unlink $lockfile;
+    
+    # Unlock.
+    INN::Utils::Shlock::unlock($lockfile);
 }
 
 # write to syslog or errlog
@@ -591,29 +595,6 @@
     return $result;
 }
 
-sub shlock {
-    my $lockfile = shift;
-
-    my $locktry = 0;
-    while ($locktry < 60) {
-        if (system("$INN::Config::newsbin/shlock", '-p', $$, '-f', $lockfile) == 0) {
-            return 1;
-        }
-        $locktry++;
-        sleep 2;
-    }
-
-    my $lockreason;
-    if (open(LOCKFILE, $lockfile)) {
-        $lockreason = 'held by ' . (<LOCKFILE> || '?');
-        close LOCKFILE;
-    } else {
-        $lockreason = $!;
-    }
-    logdie("Cannot get lock $lockfile: $lockreason");
-    return undef;
-}
-
 # If $body is not defined, returns a file handle which must be closed.
 # Don't forget checking the return value of close().
 # $addresses may be a scalar or a reference to a list of addresses.
@@ -634,7 +615,7 @@
         $sm .= ' ' . join(' ', @addrs);
     }
 
-    # fork and spawn the MTA whitout using the shell
+    # fork and spawn the MTA without using the shell
     my $pid = open(MTA, '|-');
     logdie('Cannot fork: ' . $!) if $pid < 0;
     if ($pid == 0) {

Modified: control/modules/newgroup.pl
===================================================================
--- control/modules/newgroup.pl	2011-08-04 22:09:57 UTC (rev 9303)
+++ control/modules/newgroup.pl	2011-08-04 22:10:47 UTC (rev 9304)
@@ -216,7 +216,11 @@
 
 sub update_desc {
     my ($name, $desc) = @_;
-    shlock("$INN::Config::locks/LOCK.newsgroups");
+    my $lockfile = "$INN::Config::locks/LOCK.newsgroups";
+
+    # Acquire a lock.
+    INN::Utils::Shlock::lock($lockfile, 60) or logdie("Cannot create lockfile $lockfile");
+
     my $tempfile = "$INN::Config::newsgroups.$$";
     open(NEWSGROUPS, $INN::Config::newsgroups)
         or logdie("Cannot open $INN::Config::newsgroups: $!");
@@ -237,7 +241,10 @@
     close NEWSGROUPS;
     rename($tempfile, $INN::Config::newsgroups)
         or logdie("Cannot rename $tempfile: $!");
-    unlink("$INN::Config::locks/LOCK.newsgroups", $tempfile);
+    unlink($tempfile);
+
+    # Unlock.
+    INN::Utils::Shlock::unlock($lockfile);
 }
 
 # Check the group name.  This is partially derived from C News.

Modified: control/modules/rmgroup.pl
===================================================================
--- control/modules/rmgroup.pl	2011-08-04 22:09:57 UTC (rev 9303)
+++ control/modules/rmgroup.pl	2011-08-04 22:10:47 UTC (rev 9304)
@@ -73,7 +73,11 @@
     } elsif ($action eq 'doit' and $status !~ /(not change|be unapproved)/) {
         ctlinnd('rmgroup', $groupname);
         # Update newsgroups too.
-        shlock("$INN::Config::locks/LOCK.newsgroups");
+        my $lockfile = "$INN::Config::locks/LOCK.newsgroups";
+
+        # Acquire a lock.
+        INN::Utils::Shlock::lock($lockfile, 60) or logdie("Cannot create lockfile $lockfile");
+
         open(NEWSGROUPS, $INN::Config::newsgroups)
             or logdie("Cannot open $INN::Config::newsgroups: $!");
         my $tempfile = "$INN::Config::newsgroups.$$";
@@ -85,9 +89,11 @@
         close NEWSGROUPS;
         rename($tempfile, $INN::Config::newsgroups)
             or logdie("Cannot rename $tempfile: $!");
-        unlink "$INN::Config::locks/LOCK.newsgroups";
         unlink $tempfile;
 
+        # Unlock.
+        INN::Utils::Shlock::unlock($lockfile);
+
         logger($log, "rmgroup $groupname $status $sender", $article)
             if $log;
     }


Property changes on: branches/2.5/doc/man
___________________________________________________________________
Modified: svn:ignore
   - active.5
active.times.5
actsync.8
archive.8
auth_krb5.8
batcher.8
buffchan.8
buffindexed.conf.5
ckpasswd.8
cnfsheadconf.8
cnfsstat.8
control.ctl.5
controlchan.8
convdate.1
ctlinnd.8
cvtbatch.8
cycbuff.conf.5
distrib.pats.5
distributions.5
docheckgroups.8
domain.8
expire.ctl.5
expire.8
expireover.8
expirerm.8
fastrm.1
getlist.1
grephistory.1
ident.8
incoming.conf.5
inews.1
inn.conf.5
INN__Config.3pm
innbind.8
inncheck.8
innconfval.1
innd.8
inndf.8
innfeed.conf.5
innfeed.8
innmail.1
innupgrade.8
innxmit.8
libauth.3
libinnhist.3
libstorage.3
list.3
mailpost.8
makedbz.8
makehistory.8
mod-active.8
moderators.5
motd.news.5
newsfeeds.5
news.daily.8
news2mail.8
newslog.5
newsgroups.5
ninpaths.8
nnrpd.8
nntpsend.8
nntpsend.ctl.5
ovdb.5
ovdb_init.8
ovdb_monitor.8
ovdb_server.8
ovdb_stat.8
overchan.8
passwd.nntp.5
perl-nocem.8
pgpverify.1
prunehistory.8
pullnews.1
qio.3
radius.8
radius.conf.5
rc.news.8
readers.conf.5
rnews.1
sasl.conf.5
scanlogs.8
scanspool.8
send-uucp.8
sendinpaths.8
shlock.1
simpleftp.1
sm.1
storage.conf.5
subscriptions.5
tally.control.8
tdx-util.8
tinyleaf.8
tst.3
uwildmat.3

   + active.5
active.times.5
actsync.8
archive.8
auth_krb5.8
batcher.8
buffchan.8
buffindexed.conf.5
ckpasswd.8
cnfsheadconf.8
cnfsstat.8
control.ctl.5
controlchan.8
convdate.1
ctlinnd.8
cvtbatch.8
cycbuff.conf.5
distrib.pats.5
distributions.5
docheckgroups.8
domain.8
expire.ctl.5
expire.8
expireover.8
expirerm.8
fastrm.1
getlist.1
grephistory.1
ident.8
incoming.conf.5
inews.1
inn.conf.5
INN__Config.3pm
INN__Utils__Shlock.3pm
innbind.8
inncheck.8
innconfval.1
innd.8
inndf.8
innfeed.conf.5
innfeed.8
innmail.1
innupgrade.8
innxmit.8
libauth.3
libinnhist.3
libstorage.3
list.3
mailpost.8
makedbz.8
makehistory.8
mod-active.8
moderators.5
motd.news.5
newsfeeds.5
news.daily.8
news2mail.8
newslog.5
newsgroups.5
ninpaths.8
nnrpd.8
nntpsend.8
nntpsend.ctl.5
ovdb.5
ovdb_init.8
ovdb_monitor.8
ovdb_server.8
ovdb_stat.8
overchan.8
passwd.nntp.5
perl-nocem.8
pgpverify.1
prunehistory.8
pullnews.1
qio.3
radius.8
radius.conf.5
rc.news.8
readers.conf.5
rnews.1
sasl.conf.5
scanlogs.8
scanspool.8
send-uucp.8
sendinpaths.8
shlock.1
simpleftp.1
sm.1
storage.conf.5
subscriptions.5
tally.control.8
tdx-util.8
tinyleaf.8
tst.3
uwildmat.3


Modified: doc/man/Makefile
===================================================================
--- doc/man/Makefile	2011-08-04 22:09:57 UTC (rev 9303)
+++ doc/man/Makefile	2011-08-04 22:10:47 UTC (rev 9304)
@@ -11,7 +11,8 @@
 SEC3	= clientlib.3 dbz.3 inndcomm.3 libauth.3 libinn.3 libinnhist.3 \
 	libstorage.3 list.3 qio.3 tst.3 uwildmat.3
 
-SEC3PM	= INN__Config.3pm
+SEC3PM	= INN__Config.3pm \
+	INN__Utils__Shlock.3pm
 
 SEC5	= active.5 active.times.5 buffindexed.conf.5 control.ctl.5 \
 	cycbuff.conf.5 distrib.pats.5 distributions.5 expire.ctl.5 history.5 incoming.conf.5 \
@@ -51,6 +52,7 @@
 
 install-man3pm:
 	$(CP_MAN) INN__Config.3pm $D$(MAN3PM)/INN\:\:Config.$(MAN3PM_EXT)
+	$(CP_MAN) INN__Utils__Shlock.3pm $D$(MAN3PM)/INN\:\:Utils\:\:Shlock.$(MAN3PM_EXT)
 
 # We also create symbolic links between config files and programs.
 # We try to use relative symbolic links, when possible.  As '-ef' is

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2011-08-04 22:09:57 UTC (rev 9303)
+++ doc/pod/news.pod	2011-08-04 22:10:47 UTC (rev 9304)
@@ -96,6 +96,15 @@
 
 =item *
 
+Fixed an issue on systems which do not have a working flock(2) function
+(Solaris, for instance).  B<mailpost> and B<pullnews> are reported not to
+be usable on such systems.  Many thanks to Dennis Davis for the bug report.
+
+A wrapper around B<shlock> is now called in Perl scripts.  The
+INN::Utils::Shlock module has been added for that use.
+
+=item *
+
 Fixed an issue in the Python access hook for B<nnrpd>:  it has not been
 working since S<Python 2.5> on 64-bit platforms, owing to a change to
 Python's C API, using a new Py_ssize_t type definition instead of int.

Modified: doc/pod/shlock.pod
===================================================================
--- doc/pod/shlock.pod	2011-08-04 22:09:57 UTC (rev 9303)
+++ doc/pod/shlock.pod	2011-08-04 22:10:47 UTC (rev 9304)
@@ -16,6 +16,9 @@
 create the lock file, or non-zero if the file refers to a currently
 active process.
 
+A Perl wrapper around B<shlock> can be used via the C<INN::Utils::Shlock>
+module.
+
 =head1 OPTIONS
 
 =over 4
@@ -72,4 +75,8 @@
 
 $Id$
 
+=head1 SEE ALSO
+
+INN::Utils::Shlock(3pm).
+
 =cut

Modified: frontends/mailpost.in
===================================================================
--- frontends/mailpost.in	2011-08-04 22:09:57 UTC (rev 9303)
+++ frontends/mailpost.in	2011-08-04 22:10:47 UTC (rev 9304)
@@ -18,6 +18,7 @@
 use IPC::Open3;
 use IO::Select;
 use POSIX qw(setsid);
+use INN::Utils::Shlock;
 use strict;
 
 my $debugging = 0 ;
@@ -30,11 +31,6 @@
     unlink ($tmpfile2) if $tmpfile2 ;		# in case we die()
 }
 
-my $LOCK_SH = 1;
-my $LOCK_EX = 2;
-my $LOCK_NB = 4;
-my $LOCK_UN = 8;
-
 my $usage = $0 ;
 $usage =~ s!.*/!! ;
 my $prog = $usage ;
@@ -377,22 +373,13 @@
 
 $message_id = "${lhs}\@${rhs}";
 
-push @errorText, "(TAS Message-ID database for $message_id)\n";
+push @errorText, "(TAS message-ID database for $message_id)\n";
 
 my $lockfile = sprintf("%s.lock", $Database);
 
-open(LOCKFILE, "<$lockfile") || 
-    open(LOCKFILE, ">$lockfile") ||
-    mailArtAndDie ("can't open $lockfile: $!") ;
+# Acquire a lock.
+INN::Utils::Shlock::lock($lockfile, 5) or mailArtAndDie ("cannot create lockfile $lockfile");
 
-my $i ;
-for ($i = 0 ; $i < 5 ; $i++) {
-    flock(LOCKFILE, $LOCK_EX) && last ;
-    sleep 1 ;
-}
-
-mailArtAndDie ("can't lock $lockfile: $!") if ($i == 5) ;
-
 my %DATABASE ;
 dbmopen(%DATABASE, $Database, 0666) || mailArtAndDie ("can't dbmopen $Database: $!");
 
@@ -416,8 +403,8 @@
 
 dbmclose(%DATABASE) || mailArtAndDie ("can't dbmclose $Database: $!") ;
 
-flock(LOCKFILE, $LOCK_UN) || mailArtAndDie ("can't unlock $lockfile: $!");
-close LOCKFILE ;
+# Unlock.
+INN::Utils::Shlock::unlock($lockfile) or mailArtAndDie ("cannot unlock $lockfile");
 
 ## For crosspost.
 
@@ -442,17 +429,9 @@
 
   sleep $opt_c ;
 
-  open(LOCKFILE, "<$lockfile") || 
-    open(LOCKFILE, ">$lockfile") ||
-      mailArtAndDie ("can't open $lockfile: $!") ;
+  # Acquire a lock.
+  INN::Utils::Shlock::lock($lockfile, 5) or mailArtAndDie ("cannot create lockfile $lockfile");
 
-  my $i ;
-  for ($i = 0 ; $i < 5 ; $i++) {
-    flock(LOCKFILE, $LOCK_EX) && last ;
-    sleep 1 ;
-  }
-  mailArtAndDie ("can't lock $lockfile: $!") if ($i == 5) ;
-
   my $umask_bak = umask();
   umask(000);
   dbmopen(%DATABASE, $Database, 0666) || mailArtAndDie ("can't dbmopen $Database: $!");
@@ -464,8 +443,8 @@
 
   dbmclose(%DATABASE) || mailArtAndDie ("can't dbmclose $Database: $!") ;
 
-  flock(LOCKFILE, $LOCK_UN) || mailArtAndDie ("can't unlock $lockfile: $!");
-  close LOCKFILE ;
+  # Unlock.
+  INN::Utils::Shlock::unlock($lockfile) or mailArtAndDie ("cannot unlock $lockfile");
 
   if (defined($dup)) {
     syslog("err", "mismatch $newsgroups") if $debugging && $use_syslog;

Modified: frontends/pullnews.in
===================================================================
--- frontends/pullnews.in	2011-08-04 22:09:57 UTC (rev 9303)
+++ frontends/pullnews.in	2011-08-04 22:10:47 UTC (rev 9304)
@@ -62,8 +62,7 @@
 use Getopt::Std;
 use IO::Handle;
 use POSIX qw(ceil floor);
-use Fcntl;
-use Fcntl qw(:flock);
+use INN::Utils::Shlock;
 use strict;
 
 my $usage = $0;
@@ -268,23 +267,15 @@
 }
 open(LOG, $logFile) || die "can't open logfile ($logFile)!: $!\n";
 
+# Forces a flush after each write or print.
 my $oldfh = select;
 $| = 1; select LOG; $| = 1; select $oldfh;
 
 my $lockfile = $groupFile . '.pid';
-sysopen (LOCK, "$lockfile", O_RDWR | O_CREAT, 0700) ||
-    die "can't create lock file ($lockfile): $!\n";
-$oldfh = select; select LOCK; $| = 1; select $oldfh;
 
-if (!flock (LOCK, LOCK_EX | LOCK_NB)) {
-    seek LOCK, 0, 0;
-    my $otherpid = <LOCK>;
-    chomp $otherpid;
-    die "Another pullnews (pid: $otherpid) seems to be running.\n";
-}
+# Acquire a lock.
+INN::Utils::Shlock::lock($lockfile) or die "cannot create lockfile $lockfile\n";
 
-print LOCK "$$\n";
-
 print LOG scalar(localtime(time)), " start\n\n" unless $quiet;
 
 if (@groupsToGet && ! $quiet) {
@@ -543,8 +534,8 @@
 }
 
 sub cleanLock {
-    flock (LOCK, LOCK_UN);
-    unlink $lockfile if defined $lockfile;
+    # Unlock.
+    INN::Utils::Shlock::unlock($lockfile) if defined $lockfile;
 }
 
 sub bail {


Property changes on: branches/2.5/perl/INN/Utils
___________________________________________________________________
Added: svn:ignore
   + Shlock.pm


Modified: perl/Makefile
===================================================================
--- perl/Makefile	2011-08-04 22:09:57 UTC (rev 9303)
+++ perl/Makefile	2011-08-04 22:10:47 UTC (rev 9304)
@@ -4,7 +4,8 @@
 
 top	      = ..
 
-ALL           =
+ALL           = INN/Utils/Shlock.pm
+
 EXTRA         = INN/Config.pm
 
 ##  The double underscore '__' will be converted into two colons '::'
@@ -12,12 +13,13 @@
 ##  file, and we cannot generate the right file with '::' in the
 ##  Subversion man directory because it would always be regenerated:
 ##  the file containing '__' would indeed not be found).
-MAN           = ../doc/man/INN__Config.3pm
+MAN           = ../doc/man/INN__Config.3pm \
+		../doc/man/INN__Utils__Shlock.3pm
 
 all: $(ALL) $(EXTRA) $(MAN)
 
 install: all
-	for F in $(EXTRA) ; do \
+	for F in $(ALL) $(EXTRA) ; do \
 	    $(CP_RPUB) $$F $D$(PATHLIBPERL)/$$F ; \
 	done
 
@@ -40,6 +42,14 @@
 	@echo Run configure before running make.  See INSTALL for details.
 	@exit 1
 
+##  Compilation rules.
+
+FIX		= $(FIXSCRIPT)
+
+INN/Utils/Shlock.pm: INN/Utils/Shlock.pm.in	$(FIX) ; $(FIX) INN/Utils/Shlock.pm.in
+
 ../doc/man/INN__Config.3pm: INN/Config.pm.in
 	$(POD2MAN) -s '$(MAN3PM_EXT)' -n "INN::Config" $? > $@
 
+../doc/man/INN__Utils__Shlock.3pm: INN/Utils/Shlock.pm.in
+	$(POD2MAN) -s '$(MAN3PM_EXT)' -n "INN::Utils::Shlock" $? > $@

Modified: support/mkmanifest
===================================================================
--- support/mkmanifest	2011-08-04 22:09:57 UTC (rev 9303)
+++ support/mkmanifest	2011-08-04 22:10:47 UTC (rev 9304)
@@ -175,6 +175,7 @@
 innfeed/version.c
 nnrpd/nnrpd
 perl/INN/Config.pm
+perl/INN/Utils/Shlock.pm
 samples/buffindexed.conf
 samples/inn.conf
 samples/innreport.conf




More information about the inn-committers mailing list