git: 0cb61a320a70 - main - ee: restore the stdin/stdout terminal check

Yuri Pankov yuripv at FreeBSD.org
Sun Apr 11 21:49:18 UTC 2021


The branch main has been updated by yuripv:

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

commit 0cb61a320a7036f674f70e6487a5b0e44deb73b9
Author:     Yuri Pankov <yuripv at FreeBSD.org>
AuthorDate: 2021-04-11 21:44:29 +0000
Commit:     Yuri Pankov <yuripv at 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);


More information about the dev-commits-src-all mailing list