summaryrefslogtreecommitdiffstats
path: root/term-utils/script.c
diff options
context:
space:
mode:
authorKarel Zak2013-12-02 13:42:01 +0100
committerKarel Zak2013-12-02 13:42:01 +0100
commitf50473e7ca7354160c650850b497fc819cbea162 (patch)
treef322ef521dc556f2bd3545d1da3c76d1d218da97 /term-utils/script.c
parentsetterm: fix -dump man page info (diff)
downloadkernel-qcow2-util-linux-f50473e7ca7354160c650850b497fc819cbea162.tar.gz
kernel-qcow2-util-linux-f50473e7ca7354160c650850b497fc819cbea162.tar.xz
kernel-qcow2-util-linux-f50473e7ca7354160c650850b497fc819cbea162.zip
script: check that stdin is a terminal
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/script.c')
-rw-r--r--term-utils/script.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/term-utils/script.c b/term-utils/script.c
index 1de0c3a81..c18274c1c 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();