it. In main assert that the tfd was actually invalidated. This avoids
closing an invalid fd.
ok deraadt on earlier version, tweak & ok schwarze
-/* $OpenBSD: main.c,v 1.205 2017/08/21 15:41:26 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.206 2018/02/08 01:36:38 tb Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
if (dup2(tag_files->ofd, STDOUT_FILENO) == -1)
err((int)MANDOCLEVEL_SYSERR, "pager stdout");
close(tag_files->ofd);
- close(tag_files->tfd);
+ assert(tag_files->tfd == -1);
/* Do not start the pager before controlling the terminal. */
-/* $OpenBSD: tag.c,v 1.18 2017/02/09 17:19:07 schwarze Exp $ */
+/* $OpenBSD: tag.c,v 1.19 2018/02/08 01:36:38 tb Exp $ */
/*
* Copyright (c) 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
*
ohash_delete(&tag_data);
if (stream != NULL)
fclose(stream);
+ else
+ close(tag_files.tfd);
+ tag_files.tfd = -1;
}
void