Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Apr 2021 21:49:18 GMT
From:      Yuri Pankov <yuripv@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0cb61a320a70 - main - ee: restore the stdin/stdout terminal check
Message-ID:  <202104112149.13BLnI0I067266@gitrepo.freebsd.org>

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

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

commit 0cb61a320a7036f674f70e6487a5b0e44deb73b9
Author:     Yuri Pankov <yuripv@FreeBSD.org>
AuthorDate: 2021-04-11 21:44:29 +0000
Commit:     Yuri Pankov <yuripv@FreeBSD.org>
CommitDate: 2021-04-11 21:48:45 +0000

    ee: restore the stdin/stdout terminal check
    
    This seems to have been lost during updates from upstream, and
    was reported (on IRC) as a nice feature to have (again).
    
    Reviewed by:    bapt
    Differential Revision:  https://reviews.freebsd.org/D28689
---
 contrib/ee/ee.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/contrib/ee/ee.c b/contrib/ee/ee.c
index 70a44076f882..5706dba1a20f 100644
--- a/contrib/ee/ee.c
+++ b/contrib/ee/ee.c
@@ -554,6 +554,13 @@ char *argv[];
 	for (counter = 1; counter < 24; counter++)
 		signal(counter, SIG_IGN);
 
+	/* Always read from (and write to) a terminal. */
+	if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) {
+		fprintf(stderr,
+		    "ee's standard input and output must be a terminal\n");
+		exit(1);
+	}
+
 	signal(SIGCHLD, SIG_DFL);
 	signal(SIGSEGV, SIG_DFL);
 	signal(SIGINT, edit_abort);



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