shithub: trueawk

Download patch

ref: 3c755f73f48c4a80e6014cc99ff4acc6dd91dd82
parent: 110bdc6b3e807bd672bf3b1113d01d71744a797a
author: Arnold D. Robbins <arnold@skeeve.com>
date: Thu Feb 6 16:45:46 EST 2020

Fix closeall for portability.

--- a/run.c
+++ b/run.c
@@ -1858,9 +1858,8 @@
 			continue;
 		if (ferror(files[i].fp))
 			FATAL("i/o error occurred on %s", files[i].fname);
-		if (i == 0)
-			stat = fpurge(files[i].fp) == EOF;
-		else if (i <= 2)
+
+		if (i > 0 && i < 3)
 			stat = fflush(files[i].fp) == EOF;
 		else if (files[i].mode == '|' || files[i].mode == LE)
 			stat = pclose(files[i].fp) == -1;
--