Blame SOURCES/quota-4.04-quotacheck-Avoid-question-in-non-interactive-mode.patch

273bc0
From 4179911dc38af1b6499704a7f7fb710a40c95bdb Mon Sep 17 00:00:00 2001
273bc0
From: Jan Kara <jack@suse.cz>
273bc0
Date: Mon, 5 Feb 2018 15:39:12 +0100
273bc0
Subject: [PATCH] quotacheck: Avoid question in non-interactive mode
273bc0
MIME-Version: 1.0
273bc0
Content-Type: text/plain; charset=UTF-8
273bc0
Content-Transfer-Encoding: 8bit
273bc0
273bc0
A question when quota file version is incorrect is asked even if
273bc0
quotacheck is run in non-interactive mode. Avoid asking the question in
273bc0
that case and fail the check instead.
273bc0
273bc0
Reproted-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
273bc0
Signed-off-by: Jan Kara <jack@suse.cz>
273bc0
Signed-off-by: Petr Písař <ppisar@redhat.com>
273bc0
---
273bc0
 quotacheck_v2.c | 3 ++-
273bc0
 1 file changed, 2 insertions(+), 1 deletion(-)
273bc0
273bc0
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
273bc0
index 4cc8558..86fbf42 100644
273bc0
--- a/quotacheck_v2.c
273bc0
+++ b/quotacheck_v2.c
273bc0
@@ -363,7 +363,8 @@ static int check_header(char *filename, int fd, int type, int version)
273bc0
 			 "specified on command line (%d). Quota file header "
273bc0
 			 "may be corrupted.\n"),
273bc0
 		       le32toh(head.dqh_version), version);
273bc0
-		if (!ask_yn(_("Continue checking assuming version from command line?"), 1))
273bc0
+		if (!(flags & FL_INTERACTIVE) ||
273bc0
+		    !ask_yn(_("Continue checking assuming version from command line?"), 1))
273bc0
 			return -1;
273bc0
 		detected_versions[type] = version;
273bc0
 	} else
273bc0
-- 
273bc0
2.13.6
273bc0