aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit04d39401bf641371ebd7d33949c6022bf67ee762 (patch)
treeb80ccae4c0c658aca51fc9efa7b61c1c8ffc0ee1 /mandoc.3
parent24cca2c9750d89a1dd92e9e8aee7567012175880 (diff)
downloadmandoc-04d39401bf641371ebd7d33949c6022bf67ee762.tar.gz
mandoc-04d39401bf641371ebd7d33949c6022bf67ee762.tar.zst
mandoc-04d39401bf641371ebd7d33949c6022bf67ee762.zip
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.39
1 files changed, 7 insertions, 2 deletions
diff --git a/mandoc.3 b/mandoc.3
index 9af832cc..4e04f854 100644
--- a/mandoc.3
+++ b/mandoc.3
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.3,v 1.33 2015/10/13 22:59:54 schwarze Exp $
+.\" $Id: mandoc.3,v 1.34 2016/01/08 02:13:39 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 13 2015 $
+.Dd $Mdocdate: January 8 2016 $
.Dt MANDOC 3
.Os
.Sh NAME
@@ -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