[quota/f17] Fix editting more users with edquota

Petr Pisar ppisar at fedoraproject.org
Tue Jul 3 14:40:40 UTC 2012


commit 6daab9b59558bdb06fbf70532bb15788f021ca8a
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Jul 3 16:25:58 2012 +0200

    Fix editting more users with edquota

 ...a-4.00-edquota-Fix-editting-of-more-users.patch |   35 ++++++++++++++++++++
 quota.spec                                         |    8 ++++-
 2 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/quota-4.00-edquota-Fix-editting-of-more-users.patch b/quota-4.00-edquota-Fix-editting-of-more-users.patch
new file mode 100644
index 0000000..466eb2c
--- /dev/null
+++ b/quota-4.00-edquota-Fix-editting-of-more-users.patch
@@ -0,0 +1,35 @@
+Fix editting more users with edquota
+
+Back-ported for 4.00 from upstream commit:
+
+From e7cdf879468501b1be6c3ab9add1c9ec056093ab Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack at suse.cz>
+Date: Wed, 23 May 2012 15:29:31 +0200
+Subject: [PATCH 1/2] edquota: Fix editting of more users
+
+We reopened temporary file with editted quota limits in O_RDONLY mode after
+user has edited the limits. This is problematic when edquota is called to
+edit more users because then we cannot write limits for the next user to
+the file. So reopen the file O_RDWR mode.
+
+
+diff --git a/edquota.c b/edquota.c
+index ef9fc9b..f433417 100644
+--- a/edquota.c
++++ b/edquota.c
+@@ -333,7 +333,11 @@ int main(int argc, char **argv)
+ 				continue;
+ 			}
+ 			close(tmpfd);
+-			if ((tmpfd = open(tmpfil, O_RDONLY)) < 0)
++			/*
++			 * Open in rw mode because we can reuse the file for
++			 * editting next user as well.
++			 */
++			if ((tmpfd = open(tmpfil, O_RDWR)) < 0)
+ 				die(1, _("Cannot reopen!"));
+ 			if (readprivs(curprivs, tmpfd) < 0) {
+ 				errstr(_("Cannot read quotas from file.\n"));
+-- 
+1.7.7.6
+
diff --git a/quota.spec b/quota.spec
index 541ccfc..c0cfb80 100644
--- a/quota.spec
+++ b/quota.spec
@@ -5,7 +5,7 @@ Name: quota
 Summary: System administration tools for monitoring users' disk usage
 Epoch: 1
 Version: 4.00
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: BSD and GPLv2+
 URL: http://sourceforge.net/projects/linuxquota/
 Group: System Environment/Base
@@ -32,6 +32,8 @@ Patch5: quota-4.00_pre1-Check-set-limits-fit-into-the-range-supported-by-RPC.pat
 Patch6: quota-4.00_pre1-Store-PID-of-quota_nld.patch
 # In upstream after 4.00 (SF#3393151), bug #731622
 Patch7: quota-4.00-Do-not-report-missing-utmp-record-to-syslog.patch
+# In upstream after 4.00
+Patch8: quota-4.00-edquota-Fix-editting-of-more-users.patch
 
 
 %description
@@ -111,6 +113,7 @@ Linux/UNIX environment.
 %patch5 -p1 -b .check_set_limits_rpc
 %patch6 -p1 -b .store_pid
 %patch7 -p1 -b .suppress_missing_utmp
+%patch8 -p1 -b .edquota_more_users
 
 #fix typos/mistakes in localized documentation
 for pofile in $(find ./po/*.p*)
@@ -236,6 +239,9 @@ echo '  systemd-sysv-convert --apply quota_nld'
 
 
 %changelog
+* Tue Jul 03 2012 Petr Pisar <ppisar at redhat.com> - 1:4.00-4
+- Fix editting more users with edquota
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:4.00-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list