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
This commit is contained in:
Yuri Pankov 2021-04-12 00:44:29 +03:00
parent 7763814fc9
commit 0cb61a320a

View File

@ -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);