From: Paul Eggert Date: Tue, 30 Sep 2003 19:29:47 +0000 (+0000) Subject: * lib/Autom4te/XFile.pm: Use Errno. X-Git-Tag: AUTOCONF-2.57f~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af43b2b7865dd18dc87fffed0bc1fea203b81289;p=thirdparty%2Fautoconf.git * lib/Autom4te/XFile.pm: Use Errno. (lock): Ignore ENOLCK errors. Problem reported Andreas Schwab in . --- diff --git a/ChangeLog b/ChangeLog index 3ea84445..ae2a43cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-09-30 Paul Eggert + + * lib/Autom4te/XFile.pm: Use Errno. + (lock): Ignore ENOLCK errors. Problem reported Andreas Schwab in + . + 2003-09-30 Akim Demaille * config/announce-gen (&print_news_deltas): Extracted from... diff --git a/lib/Autom4te/XFile.pm b/lib/Autom4te/XFile.pm index 6be641d6..643d264e 100644 --- a/lib/Autom4te/XFile.pm +++ b/lib/Autom4te/XFile.pm @@ -87,6 +87,7 @@ require 5.000; use strict; use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA); use Carp; +use Errno; use IO::File; use File::Basename; use Autom4te::ChannelDefs; @@ -216,7 +217,15 @@ sub lock { my ($fh, $mode) = @_; # Cannot use @_ here. - if (!flock ($fh, $mode)) + + # On some systems (e.g. GNU/Linux with NFSv2), flock(2) does not work over + # NFS, but Perl prefers that over fcntl(2) if it exists and if + # perl was not built with -Ud_flock. Normally, this problem is harmless, + # so ignore the ENOLCK errors that are reported in that situation, + # However, if the invoker is using "make -j", the problem is not harmless, + # so report it in that case. Admittedly this is a bit of a hack. + if (!flock ($fh, $mode) + && (!$!{ENOLCK} || " $ENV{'MAKEFLAGS'} " =~ / -j /)) { my $file = $fh->name; fatal "cannot lock $file with mode $mode: $!";