* lib/Automake/XFile.pm (lock): Make sure $ENV{'MAKEFLAGS'} exists
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 1 Nov 2004 17:35:37 +0000 (17:35 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 1 Nov 2004 17:35:37 +0000 (17:35 +0000)
before inspecting it; this fixes "uninitialized value in
concatenation" diagnostics when flock fails.
Report from Gary V. Vaughan.

ChangeLog
lib/Automake/XFile.pm

index 0941940..92350ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-11-01  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * lib/Automake/XFile.pm (lock): Make sure $ENV{'MAKEFLAGS'} exists
+       before inspecting it; this fixes "uninitialized value in
+       concatenation" diagnostics when flock fails.
+       Report from Gary V. Vaughan.
+
        * aclocal.in: Use strict and -w.  Declare local variables with `my',
        and get rid of `local'.
        (scan_m4_files, add_macro): Reindent these functions while we are
index 279317b..dc39ffe 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -228,10 +228,12 @@ sub lock
   # Admittedly this is a bit of a hack.
   if (!flock ($fh, $mode)
       && (!$!{ENOLCK}
-         || " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*j|---?jobs)/))
+         || (exists $ENV{'MAKEFLAGS'}
+             && " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*j|---?jobs)/)))
     {
       my $file = $fh->name;
-      fatal "cannot lock $file with mode $mode (perhaps you are running make -j on a lame NFS client?): $!";
+      fatal ("cannot lock $file with mode $mode "
+            . "(perhaps you are running make -j on a lame NFS client?): $!");
     }
 }