cd4ae93
From b9525abadba082073e20e54ee7ad2423fc1ae6a8 Mon Sep 17 00:00:00 2001
cd4ae93
From: Jan Kara <jack@suse.cz>
cd4ae93
Date: Mon, 5 Feb 2018 16:27:59 +0100
cd4ae93
Subject: [PATCH] quotacheck: Fail check if quota file magic is invalid
cd4ae93
MIME-Version: 1.0
cd4ae93
Content-Type: text/plain; charset=UTF-8
cd4ae93
Content-Transfer-Encoding: 8bit
cd4ae93
cd4ae93
Currently quotacheck will just continue if quotafile magic is invalid.
cd4ae93
Instead ask whether we should continue assuming quota format passed from
cd4ae93
the command line.
cd4ae93
cd4ae93
Signed-off-by: Jan Kara <jack@suse.cz>
cd4ae93
Signed-off-by: Petr Písař <ppisar@redhat.com>
cd4ae93
---
cd4ae93
 quotacheck_v2.c | 3 +++
cd4ae93
 1 file changed, 3 insertions(+)
cd4ae93
cd4ae93
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
cd4ae93
index 86fbf42..465765b 100644
cd4ae93
--- a/quotacheck_v2.c
cd4ae93
+++ b/quotacheck_v2.c
cd4ae93
@@ -357,6 +357,9 @@ static int check_header(char *filename, int fd, int type, int version)
cd4ae93
 	    le32toh(head.dqh_version) > known_versions[type]) {
cd4ae93
 		errstr(_("WARNING - Quota file %s has corrupted headers\n"),
cd4ae93
 			filename);
cd4ae93
+		if (!(flags & FL_INTERACTIVE) ||
cd4ae93
+		    !ask_yn(_("Continue checking assuming format from command line?"), 0))
cd4ae93
+			return -1;
cd4ae93
 	}
cd4ae93
 	if (le32toh(head.dqh_version) != version) {
cd4ae93
 		errstr(_("Quota file format version %d does not match the one "
cd4ae93
-- 
cd4ae93
2.13.6
cd4ae93