From: Karel Zak Date: Mon, 2 Dec 2013 12:42:01 +0000 (+0100) Subject: script: check that stdin is a terminal X-Git-Tag: v2.25-rc1~706 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f50473e7ca7354160c650850b497fc819cbea162;p=thirdparty%2Futil-linux.git script: check that stdin is a terminal Signed-off-by: Karel Zak --- diff --git a/term-utils/script.c b/term-utils/script.c index 1de0c3a816..c18274c1c2 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -229,6 +229,10 @@ main(int argc, char **argv) { fname = DEFAULT_OUTPUT; die_if_link(fname); } + + if (!isatty(STDIN_FILENO)) + errx(EXIT_FAILURE, _("The stdin is not a terminal.")); + if ((fscript = fopen(fname, aflg ? "a" : "w")) == NULL) { warn(_("cannot open %s"), fname); fail();