=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/main.c,v retrieving revision 1.167 retrieving revision 1.168 diff -c -r1.167 -r1.168 *** src/usr.bin/mandoc/main.c 2015/12/15 17:36:19 1.167 --- src/usr.bin/mandoc/main.c 2016/01/08 02:13:35 1.168 *************** *** 1,4 **** ! /* $OpenBSD: main.c,v 1.167 2015/12/15 17:36:19 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: main.c,v 1.168 2016/01/08 02:13:35 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze *************** *** 679,687 **** /* Begin by parsing the file itself. */ assert(file); ! assert(fd >= -1); rctmp = mparse_readfd(curp->mp, fd, file); if (rc < rctmp) rc = rctmp; --- 679,689 ---- /* Begin by parsing the file itself. */ assert(file); ! assert(fd > 0); rctmp = mparse_readfd(curp->mp, fd, file); + if (fd != STDIN_FILENO) + close(fd); if (rc < rctmp) rc = rctmp;