summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-10-30 18:17:47 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-10-30 18:18:07 (EDT)
commit1cc3c0f2fbc80b6382388e438ad29b17f261f593 (patch)
tree253a9409b5df2d556d2501dcda62d0784499a966
parent422e80c690b45df5764d2f454b8816f30b62e0e1 (diff)
downloadfirman.sh-1cc3c0f2fbc80b6382388e438ad29b17f261f593.zip
firman.sh-1cc3c0f2fbc80b6382388e438ad29b17f261f593.tar.gz
firman.sh-1cc3c0f2fbc80b6382388e438ad29b17f261f593.tar.bz2
tools/shmin.sh: Close input file's FD
-rwxr-xr-xtools/shmin.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/shmin.sh b/tools/shmin.sh
index f84e31d..4c3c40b 100755
--- a/tools/shmin.sh
+++ b/tools/shmin.sh
@@ -188,7 +188,12 @@ minify()
fgetc
done
- # We made it. Now write the output.
+ # We made it. Now close input file.
+ if ! exec 3<&-; then
+ die 'Cannot close file "%s"' "${input}"
+ fi
+
+ # Write the output.
if ! printf '%s' "${buffer}" >"${output}~"; then
die 'Cannot write file "%s"' "${output}~"
fi