summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-04-19 23:58:00 +0000
committerjmallett <jmallett@FreeBSD.org>2002-04-19 23:58:00 +0000
commit9a8a89647a9e0da8bba19e41c0981ddc84eb8187 (patch)
tree4e45febc1e60bb431e422cb54792c7db82c099ff /usr.bin
parentc63138122852627ab1508bf97af204601edc4f3f (diff)
downloadFreeBSD-src-9a8a89647a9e0da8bba19e41c0981ddc84eb8187.zip
FreeBSD-src-9a8a89647a9e0da8bba19e41c0981ddc84eb8187.tar.gz
In the case where we can't open /dev/tty, fall back to -t behaviour.
Submitted by: fenner
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/xargs/xargs.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index 06a9adf..1ec7766 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -392,15 +392,13 @@ run(char **argv)
(void)fprintf(stderr, "%s", *argv);
for (p = argv + 1; *p; ++p)
(void)fprintf(stderr, " %s", *p);
- if (pflag) {
- if ((ttyfp = fopen("/dev/tty", "r")) != NULL) {
- (void)fprintf(stderr, "?");
- (void)fflush(stderr);
- ch = getc(ttyfp);
- fclose(ttyfp);
- if (ch != 'y')
- return;
- }
+ if (pflag && (ttyfp = fopen("/dev/tty", "r")) != NULL) {
+ (void)fprintf(stderr, "?");
+ (void)fflush(stderr);
+ ch = getc(ttyfp);
+ fclose(ttyfp);
+ if (ch != 'y')
+ return;
} else {
(void)fprintf(stderr, "\n");
(void)fflush(stderr);
OpenPOWER on IntegriCloud