From: Mark Hansen Date: Tue, 2 Mar 2021 08:14:13 +0000 (+1100) Subject: Close output file descriptor only after done writing X-Git-Tag: 2.47.0~14^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa341dfafa8d757dbd5f9f12e9618b0b56ab26f3;p=graphviz 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 --- 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); }