From e4466b68cc40b752e5c079afbfbadbb06489461e Mon Sep 17 00:00:00 2001 From: "m. allan noah" Date: Wed, 10 Feb 2010 20:56:25 -0500 Subject: [PATCH] exit with error if stdout isatty() --- ChangeLog | 1 + frontend/scanimage.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 379fab48c..dfa0067cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2010-02-10 m. allan noah * acinclude.m4, configure: missing $ in variable expansion + * frontend/scanimage.c: exit with error if stdout isatty() 2010-02-10 m. allan noah * backend/cardscan.[ch], backend/cardscan.conf.in, diff --git a/frontend/scanimage.c b/frontend/scanimage.c index 39b36faa2..8657a727a 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -2208,6 +2208,11 @@ List of available devices:", prog_name); "Scanning %d pages, incrementing by %d, numbering from %d\n", batch_count, batch_increment, batch_start_at); + else if(isatty(fileno(stdout))){ + fprintf (stderr,"%s: output is not a file, exiting\n", prog_name); + exit (1); + } + do { char path[PATH_MAX];