Module Name:    src
Committed By:   rillig
Date:           Wed Sep  2 04:32:13 UTC 2020

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

Log Message:
make(1): fix cached_stat for files with st_mtime 0


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.bin/make/dir.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/dir.c
diff -u src/usr.bin/make/dir.c:1.134 src/usr.bin/make/dir.c:1.135
--- src/usr.bin/make/dir.c:1.134	Wed Sep  2 04:19:52 2020
+++ src/usr.bin/make/dir.c	Wed Sep  2 04:32:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.134 2020/09/02 04:19:52 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.135 2020/09/02 04:32:13 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.134 2020/09/02 04:19:52 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.135 2020/09/02 04:32:13 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.134 2020/09/02 04:19:52 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.135 2020/09/02 04:32:13 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -315,12 +315,12 @@ cached_stats(Hash_Table *htp, const char
     if (rc == -1)
 	return -1;
 
-    mst->mst_mode = sys_st.st_mode;
-    mst->mst_mtime = sys_st.st_mtime;
-
     if (sys_st.st_mtime == 0)
 	sys_st.st_mtime = 1;	/* avoid confusion with missing file */
 
+    mst->mst_mode = sys_st.st_mode;
+    mst->mst_mtime = sys_st.st_mtime;
+
     if (entry == NULL)
 	entry = Hash_CreateEntry(htp, pathname, NULL);
     if (Hash_GetValue(entry) == NULL) {

Reply via email to