Blame SOURCES/quota-4.04-quotacheck-Fail-check-if-quota-file-magic-is-invalid.patch

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