Fix confirmation logic when detecting a tty

Reported by:	mjg
This commit is contained in:
Baptiste Daroussin 2012-08-24 21:45:52 +00:00
parent 3a480126c4
commit 204ea792b3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=239664

View File

@ -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)