chiark / gitweb /
generate: Avoid $err_file undefined warning during startup
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 11:02:59 +0000 (11:02 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 12:00:34 +0000 (12:00 +0000)
If, for example, one of the input files implied by the command line
arguments is missing, err is called with $err_file not yet set.

Handle this case.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
generate

index ad8c9ea..01c123e 100755 (executable)
--- a/generate
+++ b/generate
@@ -187,7 +187,9 @@ our %warn_unk;
 
 sub err ($) {
     my ($m) = @_;
-    die "subdirmk: ${err_file}:$.: $m\n";
+    die defined $err_file
+       ? "subdirmk: ${err_file}:$.: $m\n"
+       : "subdirmk: $m\n";
 }
 
 sub wrncore ($$) {