summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c10
-rw-r--r--tag.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/main.c b/main.c
index c3e6f766..84533fcd 100644
--- a/main.c
+++ b/main.c
@@ -531,10 +531,10 @@ out:
/* 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;
@@ -547,7 +547,7 @@ out:
/* 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);
@@ -1076,7 +1076,7 @@ spawn_pager(struct tag_files *tag_files)
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");
@@ -1094,7 +1094,7 @@ spawn_pager(struct tag_files *tag_files)
/* 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);
diff --git a/tag.c b/tag.c
index e7e402b2..381791be 100644
--- a/tag.c
+++ b/tag.c
@@ -221,11 +221,11 @@ tag_unlink(void)
pid_t tc_pgid;
if (tag_files.tcpgid != -1) {
- tc_pgid = tcgetpgrp(STDIN_FILENO);
+ tc_pgid = tcgetpgrp(tag_files.ofd);
if (tc_pgid == tag_files.pager_pid ||
tc_pgid == getpgid(0) ||
getpgid(tc_pgid) == -1)
- (void)tcsetpgrp(STDIN_FILENO, tag_files.tcpgid);
+ (void)tcsetpgrp(tag_files.ofd, tag_files.tcpgid);
}
if (*tag_files.ofn != '\0')
unlink(tag_files.ofn);