summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-05-23 15:29:31 +0200
committerJan Kara <jack@suse.cz>2012-05-23 15:29:31 +0200
commite7cdf879468501b1be6c3ab9add1c9ec056093ab (patch)
tree29df63b25514897d1ea3e958cd2ac2512179cdc0
parent127931f064d95229161b51a7b90bebf9f96ab1f3 (diff)
downloadlinuxquota-e7cdf879468501b1be6c3ab9add1c9ec056093ab.tar.gz
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. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--Changelog1
-rw-r--r--edquota.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 0e2676d..84020a7 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
Changes in quota-tools from 4.00 to 4.01
+* fixed edquota(8) for more users (Jan Kara)
* remove fixed limit on number of autofs mount points (Jan Kara)
* add quota type names to message catalogue (Jan Kara)
* typo fixes, message changes for easier i18n (Jan Kara)
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"));