From 174d00fbb876a712b40ce7bece228a17a721d647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 14 May 2018 07:54:23 +0200 Subject: [PATCH] Add notice about closing stdout/stderr file descriptors to style.md --- doc/dev/style.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/dev/style.md b/doc/dev/style.md index 8c74dcebce..45c481eb90 100644 --- a/doc/dev/style.md +++ b/doc/dev/style.md @@ -761,4 +761,6 @@ Bash should be avoided. Some pitfalls to avoid: statement, or use `"cat << EOF"`. * To set a variable from outside awk, use `"awk '{...}' var=value"` rather than `"awk -vvar=value '{...}'"` - +* Don't close stdout/stderr descriptors (`>&-`), but redirect them to /dev/null + instead (`>/dev/null`) as the closed descriptor might get reused leading to + unpredictable behaviour when using `fprintf(stderr, ...)`