aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorZhao Hongjiang <zhaohongjiang@huawei.com>2013-02-19 21:13:55 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:14 -0500
commit41735818766c0ec215b9a69591e7eae642061954 (patch)
tree564ccbbc05d987f833050573e7fad23ce34dfc89 /fs/gfs2
parent9cc64ceaa8b8e8c874519caee79e18cb35d3ce3e (diff)
fs: change return values from -EACCES to -EPERM
According to SUSv3: [EACCES] Permission denied. An attempt was made to access a file in a way forbidden by its file access permissions. [EPERM] Operation not permitted. An attempt was made to perform an operation limited to processes with appropriate privileges or to the owner of a file or other resource. So -EPERM should be returned if capability checks fails. Strictly speaking this is an API change since the error code user sees is altered. Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com> Acked-by: Jan Kara <jack@suse.cz> Acked-by: Steven Whitehouse <swhiteho@redhat.com> Acked-by: Ian Kent <raven@themaw.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/sys.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 8056b7b7238e..0acbe2ff1e5d 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -107,7 +107,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
107 int n = simple_strtol(buf, NULL, 0); 107 int n = simple_strtol(buf, NULL, 0);
108 108
109 if (!capable(CAP_SYS_ADMIN)) 109 if (!capable(CAP_SYS_ADMIN))
110 return -EACCES; 110 return -EPERM;
111 111
112 switch (n) { 112 switch (n) {
113 case 0: 113 case 0:
@@ -135,7 +135,7 @@ static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
135static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) 135static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
136{ 136{
137 if (!capable(CAP_SYS_ADMIN)) 137 if (!capable(CAP_SYS_ADMIN))
138 return -EACCES; 138 return -EPERM;
139 139
140 if (simple_strtol(buf, NULL, 0) != 1) 140 if (simple_strtol(buf, NULL, 0) != 1)
141 return -EINVAL; 141 return -EINVAL;
@@ -150,7 +150,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf,
150 size_t len) 150 size_t len)
151{ 151{
152 if (!capable(CAP_SYS_ADMIN)) 152 if (!capable(CAP_SYS_ADMIN))
153 return -EACCES; 153 return -EPERM;
154 154
155 if (simple_strtol(buf, NULL, 0) != 1) 155 if (simple_strtol(buf, NULL, 0) != 1)
156 return -EINVAL; 156 return -EINVAL;
@@ -163,7 +163,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
163 size_t len) 163 size_t len)
164{ 164{
165 if (!capable(CAP_SYS_ADMIN)) 165 if (!capable(CAP_SYS_ADMIN))
166 return -EACCES; 166 return -EPERM;
167 167
168 if (simple_strtol(buf, NULL, 0) != 1) 168 if (simple_strtol(buf, NULL, 0) != 1)
169 return -EINVAL; 169 return -EINVAL;
@@ -179,7 +179,7 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,
179 u32 id; 179 u32 id;
180 180
181 if (!capable(CAP_SYS_ADMIN)) 181 if (!capable(CAP_SYS_ADMIN))
182 return -EACCES; 182 return -EPERM;
183 183
184 id = simple_strtoul(buf, NULL, 0); 184 id = simple_strtoul(buf, NULL, 0);
185 185
@@ -194,7 +194,7 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
194 u32 id; 194 u32 id;
195 195
196 if (!capable(CAP_SYS_ADMIN)) 196 if (!capable(CAP_SYS_ADMIN))
197 return -EACCES; 197 return -EPERM;
198 198
199 id = simple_strtoul(buf, NULL, 0); 199 id = simple_strtoul(buf, NULL, 0);
200 200
@@ -213,7 +213,7 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len
213 int rv; 213 int rv;
214 214
215 if (!capable(CAP_SYS_ADMIN)) 215 if (!capable(CAP_SYS_ADMIN))
216 return -EACCES; 216 return -EPERM;
217 217
218 rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum, 218 rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum,
219 mode); 219 mode);
@@ -502,7 +502,7 @@ static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf,
502 unsigned int x, y; 502 unsigned int x, y;
503 503
504 if (!capable(CAP_SYS_ADMIN)) 504 if (!capable(CAP_SYS_ADMIN))
505 return -EACCES; 505 return -EPERM;
506 506
507 if (sscanf(buf, "%u %u", &x, &y) != 2 || !y) 507 if (sscanf(buf, "%u %u", &x, &y) != 2 || !y)
508 return -EINVAL; 508 return -EINVAL;
@@ -521,7 +521,7 @@ static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field,
521 unsigned int x; 521 unsigned int x;
522 522
523 if (!capable(CAP_SYS_ADMIN)) 523 if (!capable(CAP_SYS_ADMIN))
524 return -EACCES; 524 return -EPERM;
525 525
526 x = simple_strtoul(buf, NULL, 0); 526 x = simple_strtoul(buf, NULL, 0);
527 527