Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Dec 2020 15:00:02 GMT
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ab41d7f371f5 - sh: Explain duplicate tcsetpgrp() calls
Message-ID:  <202012261500.0BQF02Xe018635@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jilles:

URL: https://cgit.FreeBSD.org/src/commit/?id=ab41d7f371f52097ab0cb183565f1d8e7c122760

commit ab41d7f371f52097ab0cb183565f1d8e7c122760
Author:     Jilles Tjoelker <jilles@FreeBSD.org>
AuthorDate: 2020-12-26 14:27:33 +0000
Commit:     Jilles Tjoelker <jilles@FreeBSD.org>
CommitDate: 2020-12-26 14:27:33 +0000

    sh: Explain duplicate tcsetpgrp() calls
    
    This is a comment change only.
---
 bin/sh/jobs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index c46e526eab67..c0ba7d75e16d 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -928,7 +928,12 @@ forkshell(struct job *jp, union node *n, int mode)
 				pgrp = jp->ps[0].pid;
 			if (setpgid(0, pgrp) == 0 && mode == FORK_FG &&
 			    ttyfd >= 0) {
-				/*** this causes superfluous TIOCSPGRPS ***/
+				/*
+				 * Each process in a pipeline must have the tty
+				 * pgrp set before running its code.
+				 * Only for pipelines of three or more processes
+				 * could this be reduced to two calls.
+				 */
 				if (tcsetpgrp(ttyfd, pgrp) < 0)
 					error("tcsetpgrp failed, errno=%d", errno);
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012261500.0BQF02Xe018635>