Module Name:    src
Committed By:   sjg
Date:           Sat Jun  1 07:37:19 UTC 2024

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

Log Message:
make: ensure loop termination in purge_relative_cached_realpaths

You cannot ignore the return from HashIter_Next


To generate a diff of this commit:
cvs rdiff -u -r1.619 -r1.620 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.619 src/usr.bin/make/main.c:1.620
--- src/usr.bin/make/main.c:1.619	Fri May 31 05:50:11 2024
+++ src/usr.bin/make/main.c	Sat Jun  1 07:37:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.619 2024/05/31 05:50:11 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.619 2024/05/31 05:50:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.620 2024/06/01 07:37:19 sjg Exp $");
 #if defined(MAKE_NATIVE)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1971,12 +1971,13 @@ static void
 purge_relative_cached_realpaths(void)
 {
 	HashIter hi;
+	bool more;
 
 	HashIter_Init(&hi, &cached_realpaths);
-	HashIter_Next(&hi);
-	while (hi.entry != NULL) {
+	more = HashIter_Next(&hi);
+	while (more) {
 		HashEntry *he = hi.entry;
-		HashIter_Next(&hi);
+		more = HashIter_Next(&hi);
 		if (he->key[0] != '/') {
 			DEBUG1(DIR, "cached_realpath: purging %s\n", he->key);
 			HashTable_DeleteEntry(&cached_realpaths, he);

Reply via email to