From 204ea792b39cba7209d39172f04f67342f39afe3 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 24 Aug 2012 21:45:52 +0000 Subject: [PATCH] Fix confirmation logic when detecting a tty Reported by: mjg --- usr.sbin/pkg/pkg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 50e71cff0b1e..8dc7bcfd9a1a 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -427,10 +427,10 @@ main(__unused int argc, char *argv[]) */ if (getenv("ASSUME_ALWAYS_YES") == NULL) { printf("%s", confirmation_message); - if (isatty(fileno(stdin)) && - pkg_query_yes_no() == 0) + if (!isatty(fileno(stdin))) exit(EXIT_FAILURE); - else + + if (pkg_query_yes_no() == 0) exit(EXIT_FAILURE); } if (bootstrap_pkg() != 0)