Module Name:    src
Committed By:   rillig
Date:           Tue May  9 21:24:56 UTC 2023

Modified Files:
        src/usr.bin/make: var.c

Log Message:
make: improve error message for failed stat in ':mtime'


To generate a diff of this commit:
cvs rdiff -u -r1.1052 -r1.1053 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.1052 src/usr.bin/make/var.c:1.1053
--- src/usr.bin/make/var.c:1.1052	Tue May  9 20:53:23 2023
+++ src/usr.bin/make/var.c	Tue May  9 21:24:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.1052 2023/05/09 20:53:23 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.1053 2023/05/09 21:24:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1052 2023/05/09 20:53:23 sjg Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1053 2023/05/09 21:24:56 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -2862,8 +2862,12 @@ ApplyModifier_Mtime(const char **pp, Mod
 	if (!ModChain_ShouldEval(ch))
 		return AMR_OK;
 	if (stat(Expr_Str(expr), &st) < 0) {
-		if (error)
-			return AMR_BAD;
+		if (error) {
+			Parse_Error(PARSE_FATAL,
+			    "Cannot determine mtime for '%s': %s",
+			    Expr_Str(expr), strerror(errno));
+			return AMR_CLEANUP;
+		}
 		if (i < 0)
 			time(&st.st_mtime);
 		else

Reply via email to