summaryrefslogtreecommitdiffstats
path: root/mandoc.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-01-08 02:13:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-01-08 02:13:39 +0000
commitd28fad77486ce53230d4b8b5731e7f06276c2e92 (patch)
tree978f0ff0a675d9c6abde1033cf8cdd0ce705de4f /mandoc.3
parentfde5c56f70c8c331d28ac290a122dbd46c25a2e5 (diff)
downloadmandoc-d28fad77486ce53230d4b8b5731e7f06276c2e92.tar.gz
It was very surprising that a function called mparse_readfd()
closed the file descriptor passed to it after completing its work, in particular considering the fact that it required its callers to call open(2) or mparse_open() beforehand. Change mparse_readfd() to not call close(2) and change the callers to call close(2) afterwards, more or less bringing open and close to the same level of the code and making review easier. Note that man.cgi(8) already did that, even though it was wrong in the past. Small restructuring suggested by Christos Zoulas (NetBSD).
Diffstat (limited to 'mandoc.3')
-rw-r--r--mandoc.35
1 files changed, 5 insertions, 0 deletions
diff --git a/mandoc.3 b/mandoc.3
index 01a72bc6..b52f65f6 100644
--- a/mandoc.3
+++ b/mandoc.3
@@ -177,6 +177,9 @@ or
parse it with
.Fn mparse_readfd ;
.It
+close it with
+.Xr close 2 ;
+.It
retrieve the syntax tree with
.Fn mparse_result ;
.It
@@ -403,6 +406,8 @@ or
Pass the associated filename in
.Va fname .
This function may be called multiple times with different parameters; however,
+.Xr close 2
+and
.Fn mparse_reset
should be invoked between parses.
Declared in