From fa341dfafa8d757dbd5f9f12e9618b0b56ab26f3 Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Tue, 2 Mar 2021 19:14:13 +1100 Subject: [PATCH] Close output file descriptor only after done writing Previously we would close the output as soon as we wrote a single line. This didn't account for continuation lines, where $1 == "". The subsequent printfs would be to a closed file. Fixes #1965 --- doc/infosrc/brewer.awk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/infosrc/brewer.awk b/doc/infosrc/brewer.awk index cdabd9acd..2e2e89ef2 100644 --- a/doc/infosrc/brewer.awk +++ b/doc/infosrc/brewer.awk @@ -7,9 +7,13 @@ BEGIN { } /^[^#]/{ if ($1 != "") { + # Close previous file handle to avoid exhausting file descriptors on macOS + # https://gitlab.com/graphviz/graphviz/-/issues/1965 + if (name) { + close(name); + } name = "colortmp/" $1 $2; gsub ("\"","",name); } printf ("%s %s %s %s\n", $5, $7, $8, $9) > name; - close(name); } -- 2.50.1