Blame SOURCES/quota-4.04-quotacheck-Report-error-when-caching-of-quota-file-f.patch

273bc0
From 7b6dfd6390476ec7b811c76e4e2653db2994cad4 Mon Sep 17 00:00:00 2001
273bc0
From: Jan Kara <jack@suse.cz>
273bc0
Date: Mon, 5 Feb 2018 15:54:54 +0100
273bc0
Subject: [PATCH] quotacheck: Report error when caching of quota file fails
273bc0
MIME-Version: 1.0
273bc0
Content-Type: text/plain; charset=UTF-8
273bc0
Content-Transfer-Encoding: 8bit
273bc0
273bc0
Currently quotacheck returns with zero exit code even though caching of
273bc0
quota file fails. Fix it to return with non-zero exit code in that case
273bc0
as expected.
273bc0
273bc0
Reported-by: Christoph Biedl 
273bc0
Signed-off-by: Jan Kara <jack@suse.cz>
273bc0
Signed-off-by: Petr Písař <ppisar@redhat.com>
273bc0
---
273bc0
 quotacheck.c | 29 ++++++++++++++++++++++-------
273bc0
 1 file changed, 22 insertions(+), 7 deletions(-)
273bc0
273bc0
diff --git a/quotacheck.c b/quotacheck.c
273bc0
index 9d7940b..b1302b6 100644
273bc0
--- a/quotacheck.c
273bc0
+++ b/quotacheck.c
273bc0
@@ -924,6 +924,7 @@ static int check_dir(struct mount_entry *mnt)
273bc0
 	struct stat st;
273bc0
 	int remounted = 0;
273bc0
 	int failed = 0;
273bc0
+	int ret;
273bc0
 
273bc0
 	if (lstat(mnt->me_dir, &st) < 0)
273bc0
 		die(2, _("Cannot stat mountpoint %s: %s\n"), mnt->me_dir, strerror(errno));
273bc0
@@ -939,14 +940,22 @@ static int check_dir(struct mount_entry *mnt)
273bc0
 	 */
273bc0
 	if (cfmt == QF_XFS)
273bc0
 		goto start_scan;
273bc0
-	if (ucheck)
273bc0
-		if (process_file(mnt, USRQUOTA) < 0)
273bc0
+	if (ucheck) {
273bc0
+		ret = process_file(mnt, USRQUOTA);
273bc0
+		if (ret < 0) {
273bc0
+			failed |= ret;
273bc0
 			ucheck = 0;
273bc0
-	if (gcheck)
273bc0
-		if (process_file(mnt, GRPQUOTA) < 0)
273bc0
+		}
273bc0
+	}
273bc0
+	if (gcheck) {
273bc0
+		ret = process_file(mnt, GRPQUOTA);
273bc0
+		if (ret < 0) {
273bc0
+			failed |= ret;
273bc0
 			gcheck = 0;
273bc0
+		}
273bc0
+	}
273bc0
 	if (!ucheck && !gcheck)	/* Nothing to check? */
273bc0
-		return 0;
273bc0
+		return failed;
273bc0
 	if (!(flags & FL_NOREMOUNT)) {
273bc0
 		/* Now we try to remount fs read-only to prevent races when scanning filesystem */
273bc0
 		if (mount
273bc0
@@ -978,8 +987,11 @@ start_scan:
273bc0
 	    !strcmp(mnt->me_type, MNTTYPE_EXT3) ||
273bc0
 	    !strcmp(mnt->me_type, MNTTYPE_NEXT3) ||
273bc0
 	    !strcmp(mnt->me_type, MNTTYPE_EXT4)) {
273bc0
-		if ((failed = ext2_direct_scan(mnt->me_devname)) < 0)
273bc0
+		ret = ext2_direct_scan(mnt->me_devname);
273bc0
+		if (ret < 0) {
273bc0
+			failed |= ret;
273bc0
 			goto out;
273bc0
+		}
273bc0
 	}
273bc0
 	else {
273bc0
 #else
273bc0
@@ -987,8 +999,11 @@ start_scan:
273bc0
 #endif
273bc0
 		if (flags & FL_VERYVERBOSE)
273bc0
 			putchar('\n');
273bc0
-		if ((failed = scan_dir(mnt->me_dir)) < 0)
273bc0
+		ret = scan_dir(mnt->me_dir);
273bc0
+		if (ret < 0) {
273bc0
+			failed |= ret;
273bc0
 			goto out;
273bc0
+		}
273bc0
 	}
273bc0
 	dirs_done++;
273bc0
 	if (flags & FL_VERBOSE || flags & FL_DEBUG)
273bc0
-- 
273bc0
2.13.6
273bc0