From f93d7e784523485f30e9a332ada24683cb130c10 Mon Sep 17 00:00:00 2001 From: Dave Vasilevsky Date: Sat, 13 Oct 2012 08:25:08 -0400 Subject: [PATCH] If output is a TTY, print usage --- pixz.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pixz.c b/pixz.c index d9772d5..7bff608 100644 --- a/pixz.c +++ b/pixz.c @@ -101,7 +101,9 @@ int main(int argc, char **argv) { die("Can't open input file"); if (opath && !(gOutFile = fopen(opath, "w"))) die("Can't open output file"); - + if (isatty(fileno(gOutFile)) == 1) + usage("Refusing to output to a TTY"); + switch (op) { case OP_WRITE: pixz_write(tar, level); break; case OP_READ: pixz_read(tar, 0, NULL); break;