mdocml: fix man when run with stdin closed.

Patch communicated by Ingo Schwarze.
This commit is contained in:
Leah Neukirchen 2017-01-09 18:43:01 +01:00
parent 433e91a869
commit 06b70f7256
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,42 @@
--- main.c.orig
+++ main.c
@@ -551,10 +551,10 @@
/* Stop here until moved to the foreground. */
- tc_pgid = tcgetpgrp(STDIN_FILENO);
+ tc_pgid = tcgetpgrp(tag_files->ofd);
if (tc_pgid != man_pgid) {
if (tc_pgid == pager_pid) {
- (void)tcsetpgrp(STDIN_FILENO,
+ (void)tcsetpgrp(tag_files->ofd,
man_pgid);
if (signum == SIGTTIN)
continue;
@@ -567,7 +567,7 @@
/* Once in the foreground, activate the pager. */
if (pager_pid) {
- (void)tcsetpgrp(STDIN_FILENO, pager_pid);
+ (void)tcsetpgrp(tag_files->ofd, pager_pid);
kill(pager_pid, SIGCONT);
} else
pager_pid = spawn_pager(tag_files);
@@ -1082,7 +1082,7 @@
break;
default:
(void)setpgid(pager_pid, 0);
- (void)tcsetpgrp(STDIN_FILENO, pager_pid);
+ (void)tcsetpgrp(tag_files->ofd, pager_pid);
#if HAVE_PLEDGE
if (pledge("stdio rpath tmppath tty proc", NULL) == -1)
err((int)MANDOCLEVEL_SYSERR, "pledge");
@@ -1100,7 +1100,7 @@
/* Do not start the pager before controlling the terminal. */
- while (tcgetpgrp(STDIN_FILENO) != getpid())
+ while (tcgetpgrp(STDOUT_FILENO) != getpid())
nanosleep(&timeout, NULL);
execvp(argv[0], argv);

View File

@ -1,7 +1,7 @@
# Template file for 'mdocml'
pkgname=mdocml
version=1.13.4
revision=1
revision=2
build_style=configure
makedepends="sqlite-devel zlib-devel"
depends="less"