Blob Blame Raw
From 8d4c4a761c27a81d96ae8c49e1b8d32d66b6751e Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 8 Mar 2011 23:36:47 +0100
Subject: [PATCH 1/2] Fix synopsis and properly report errors during remote grace period setting

Signed-off-by: Jan Kara <jack@suse.cz>
---
 edquota.8  |    2 ++
 setquota.8 |    4 +---
 setquota.c |   11 ++++++++---
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/edquota.8 b/edquota.8
index 4b1406b..2ef4cb6 100644
--- a/edquota.8
+++ b/edquota.8
@@ -38,6 +38,8 @@ edquota \- edit user quotas
 .BR \-u \ |
 .B \-g
 ] [
+.B \-rm
+] [
 .B \-F
 .I format-name
 ] [
diff --git a/setquota.8 b/setquota.8
index e3ac7e0..6c3dc88 100644
--- a/setquota.8
+++ b/setquota.8
@@ -67,8 +67,6 @@ setquota \- set disk quotas
 .B setquota
 .B \-t
 [
-.B \-m
-] [
 .B \-u
 |
 .B \-g
@@ -86,7 +84,7 @@ setquota \- set disk quotas
 .B setquota
 .B \-T
 [
-.B \-m
+.B \-rm
 ] [
 .B \-u
 |
diff --git a/setquota.c b/setquota.c
index 5d2734b..d1cffcb 100644
--- a/setquota.c
+++ b/setquota.c
@@ -58,7 +58,7 @@ static void usage(void)
   setquota [-u|-g] %1$s[-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n\
   setquota [-u|-g] %1$s[-F quotaformat] -b [-c] -a|<filesystem>...\n\
   setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n\
-  setquota [-u|-g] [-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
+  setquota [-u|-g] %1$s[-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
 -u, --user                 set limits for user\n\
 -g, --group                set limits for group\n\
 -a, --all                  set limits for all filesystems\n\
@@ -372,14 +372,19 @@ static int batch_setlimits(struct quota_handle **handles)
 /* Set grace times */
 static int setgraces(struct quota_handle **handles)
 {
-	int i;
+	int i, ret = 0;
 
 	for (i = 0; handles[i]; i++) {
+		if (handles[i]->qh_ops->write_info) {
+			errstr(_("Setting grace period on %s is not supported.\n"), handles[i]->qh_quotadev);
+			ret = -1;
+			continue;
+		}
 		handles[i]->qh_info.dqi_bgrace = toset.dqb_btime;
 		handles[i]->qh_info.dqi_igrace = toset.dqb_itime;
 		mark_quotafile_info_dirty(handles[i]);
 	}
-	return 0;
+	return ret;
 }
 
 /* Set grace times for individual user */
-- 
1.7.4